Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 89c4d71

Browse files
Louis Yecopybara-github
authored andcommitted
Add yelouis to cloud debugger Python agent copy.bara.sky file
PiperOrigin-RevId: 259940524 Change-Id: Ic60e4d959e9d46aad6b37bf9464a9f6751657bf1
1 parent 29a3838 commit 89c4d71

9 files changed

Lines changed: 25 additions & 25 deletions

src/googleclouddebugger/bytecode_breakpoint.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void BytecodeBreakpoint::Detach() {
4848
it->second->breakpoints.clear();
4949
PatchCodeObject(it->second);
5050

51-
// TODO(vlif): assert zombie_refs.empty() after garbage collection
51+
// TODO: assert zombie_refs.empty() after garbage collection
5252
// for zombie refs is implemented.
5353

5454
delete it->second;

src/googleclouddebugger/bytecode_breakpoint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace cdbg {
2929
// Sets breakpoints in Python code with zero runtime overhead.
3030
// BytecodeBreakpoint rewrites Python bytecode to insert a breakpoint. The
3131
// implementation is specific to CPython 2.7.
32-
// TODO(vlif): rename to BreakpointsEmulator when the original implementation
32+
// TODO: rename to BreakpointsEmulator when the original implementation
3333
// of BreakpointsEmulator goes away.
3434
class BytecodeBreakpoint {
3535
public:
@@ -94,7 +94,7 @@ class BytecodeBreakpoint {
9494
// constants. Instead we store these references in a special zombie pool.
9595
// Then once we know that no Python thread is executing the code object,
9696
// we can release all of them.
97-
// TODO(vlif): implement garbage collection for zombie refs.
97+
// TODO: implement garbage collection for zombie refs.
9898
std::vector<ScopedPyObject> zombie_refs;
9999

100100
// Original value of PyCodeObject::co_stacksize before patching.

src/googleclouddebugger/bytecode_manipulator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ bool BytecodeManipulator::AppendMethodCall(
756756
// block. Unfortunately not all instructions can be moved:
757757
// 1. Instructions with relative offset can't be moved forward, because
758758
// the offset can't be negative.
759-
// TODO(vlif): FORWARD_JUMP can be replaced with ABSOLUTE_JUMP.
759+
// TODO: FORWARD_JUMP can be replaced with ABSOLUTE_JUMP.
760760
// 2. YIELD_VALUE can't be moved because generator object keeps the frame
761761
// object in between "yield" calls. If the breakpoint is added or
762762
// removed, subsequent calls into the generator will jump into invalid

src/googleclouddebugger/capture_collector.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
"""Captures application state on a breakpoint hit."""
1616

17-
# TODO(vlif): rename this file to collector.py.
17+
# TODO: rename this file to collector.py.
1818

1919
import copy
2020
import datetime
@@ -53,7 +53,7 @@
5353
_DATE_TYPES = (datetime.date, datetime.time, datetime.timedelta)
5454
_VECTOR_TYPES = (tuple, list, set)
5555

56-
# TODO(vlif): move to messages.py module.
56+
# TODO: move to messages.py module.
5757
EMPTY_DICTIONARY = 'Empty dictionary'
5858
EMPTY_COLLECTION = 'Empty collection'
5959
OBJECT_HAS_NO_FIELDS = 'Object has no fields'
@@ -396,7 +396,7 @@ def CaptureNamedVariable(self, name, value, depth, limits):
396396
"""
397397
if not hasattr(name, '__dict__'):
398398
name = str(name)
399-
else: # TODO(vlif): call str(name) with immutability verifier here.
399+
else: # TODO: call str(name) with immutability verifier here.
400400
name = str(id(name))
401401
self._total_size += len(name)
402402

@@ -488,8 +488,8 @@ def CaptureVariable(self, value, depth, limits, can_enqueue=True):
488488
def CaptureVariableInternal(self, value, depth, limits, can_enqueue=True):
489489
"""Captures a single nameless object into Variable message.
490490
491-
TODO(vlif): safely evaluate iterable types.
492-
TODO(vlif): safely call str(value)
491+
TODO: safely evaluate iterable types.
492+
TODO: safely call str(value)
493493
494494
Args:
495495
value: data to capture
@@ -537,7 +537,7 @@ def CaptureVariableInternal(self, value, depth, limits, can_enqueue=True):
537537

538538
if isinstance(value, types.FunctionType):
539539
self._total_size += len(value.__name__)
540-
# TODO(vlif): set value to func_name and type to 'function'
540+
# TODO: set value to func_name and type to 'function'
541541
return {'value': 'function ' + value.__name__}
542542

543543
if isinstance(value, Exception):
@@ -567,7 +567,7 @@ def CaptureVariableInternal(self, value, depth, limits, can_enqueue=True):
567567
'type': object_type}
568568

569569
if not hasattr(value, '__dict__'):
570-
# TODO(vlif): keep "value" empty and populate the "type" field instead.
570+
# TODO: keep "value" empty and populate the "type" field instead.
571571
r = str(type(value))
572572
self._total_size += len(r)
573573
return {'value': r}

src/googleclouddebugger/conditional_breakpoint.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ bool ConditionalBreakpoint::EvaluateCondition(PyFrameObject* frame) {
8080
line_count = immutability_tracer.GetLineCount();
8181
}
8282

83-
// TODO(vlif): clear breakpoint if condition evaluation failed due to
83+
// TODO: clear breakpoint if condition evaluation failed due to
8484
// mutable code or timeout.
8585

8686
auto eval_exception = ClearPythonException();

src/googleclouddebugger/immutability_tracer.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ static OpcodeMutableStatus IsOpcodeMutable(const uint8 opcode) {
414414
case IMPORT_FROM:
415415
case SETUP_EXCEPT:
416416
case SETUP_FINALLY:
417-
// TODO(xinghuadou): allow changing fields of locally created objects/lists.
417+
// TODO: allow changing fields of locally created objects/lists.
418418
case STORE_SUBSCR:
419419
case DELETE_SUBSCR:
420420
case STORE_NAME:
@@ -425,11 +425,11 @@ static OpcodeMutableStatus IsOpcodeMutable(const uint8 opcode) {
425425
case SET_ADD:
426426
case MAP_ADD:
427427
case STORE_DEREF:
428-
// TODO(xinghuadou): allow exception handling
428+
// TODO: allow exception handling
429429
case RAISE_VARARGS:
430430
case END_FINALLY:
431431
case SETUP_WITH:
432-
// TODO(xinghuadou): allow closures
432+
// TODO: allow closures
433433
case LOAD_CLOSURE:
434434
#if PY_MAJOR_VERSION >= 3
435435
case GET_AITER:
@@ -523,7 +523,7 @@ void ImmutabilityTracer::ProcessCodeRange(const uint8* code_start,
523523

524524
void ImmutabilityTracer::ProcessCCall(PyObject* function) {
525525
if (PyCFunction_Check(function)) {
526-
// TODO(vlif): the application code can define its own "str" function
526+
// TODO: the application code can define its own "str" function
527527
// that will do some evil things. Application can also override builtin
528528
// "str" method. If we want to protect against it, we should load pointers
529529
// to native functions when debugger initializes (which happens before
@@ -553,7 +553,7 @@ void ImmutabilityTracer::ProcessCCall(PyObject* function) {
553553

554554

555555
void ImmutabilityTracer::SetMutableCodeException() {
556-
// TODO(vlif): use custom type for this exception. This way we can provide
556+
// TODO: use custom type for this exception. This way we can provide
557557
// a more detailed error message.
558558
PyErr_SetString(
559559
PyExc_SystemError,

src/googleclouddebugger/imphook2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def AddImportCallbackBySuffix(path, callback):
6868
the callback will be invoked. This function does not validates the existence
6969
of such a module and it's the responsibility of the caller.
7070
71-
TODO(erezh): handle module reload.
71+
TODO: handle module reload.
7272
7373
Args:
7474
path: python module file path. It may be missing the directories for the
@@ -418,7 +418,7 @@ def GetModuleFromName(name, path):
418418
nonempty_modules = (m for m in modules if m)
419419

420420
for module in nonempty_modules:
421-
# TODO(emrekultursay): Write unit test to cover None case.
421+
# TODO: Write unit test to cover None case.
422422
mod_file = getattr(module, '__file__', None)
423423
if not mod_file:
424424
continue

src/googleclouddebugger/python_breakpoint.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from . import module_search2
2727
from . import module_utils2
2828

29-
# TODO(vlif): move to messages.py module.
29+
# TODO: move to messages.py module.
3030
# Use the following schema to define breakpoint error message constant:
3131
# ERROR_<Single word from Status.Reference>_<short error name>_<num params>
3232
ERROR_LOCATION_FILE_EXTENSION_0 = (
@@ -126,7 +126,7 @@ def _MultipleModulesFoundError(path, candidates):
126126

127127
def _NormalizePath(path):
128128
"""Removes surrounding whitespace, leading separator and normalize."""
129-
# TODO(emrekultursay): Calling os.path.normpath "may change the meaning of a
129+
# TODO: Calling os.path.normpath "may change the meaning of a
130130
# path that contains symbolic links" (e.g., "A/foo/../B" != "A/B" if foo is a
131131
# symlink). This might cause trouble when matching against loaded module
132132
# paths. We should try to avoid using it.
@@ -239,7 +239,7 @@ def GetBreakpointId(self):
239239

240240
def GetExpirationTime(self):
241241
"""Computes the timestamp at which this breakpoint will expire."""
242-
# TODO(emrekultursay): Move this to a common method.
242+
# TODO: Move this to a common method.
243243
if '.' not in self.definition['createTime']:
244244
fmt = '%Y-%m-%dT%H:%M:%S%Z'
245245
else:
@@ -278,7 +278,7 @@ def _ActivateBreakpoint(self, module):
278278
if not status:
279279
# First two parameters are common: the line of the breakpoint and the
280280
# module we are trying to insert the breakpoint in.
281-
# TODO(emrekultursay): Do not display the entire path of the file. Either
281+
# TODO: Do not display the entire path of the file. Either
282282
# strip some prefix, or display the path in the breakpoint.
283283
params = [str(line), os.path.splitext(module.__file__)[0] + '.py']
284284

@@ -398,7 +398,7 @@ def _BreakpointEvent(self, event, frame):
398398
collector = capture_collector.CaptureCollector(
399399
self.definition, self.data_visibility_policy)
400400

401-
# TODO(b/69119299): This is a temporary try/except. All exceptions should be
401+
# TODO: This is a temporary try/except. All exceptions should be
402402
# caught inside Collect and converted into breakpoint error messages.
403403
try:
404404
collector.Collect(frame)

src/googleclouddebugger/python_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Nullable<string> ClearPythonException() {
181181
return Nullable<string>(); // return nullptr.
182182
}
183183

184-
// TODO(vlif): call str(exception_obj) with a verification of immutability
184+
// TODO: call str(exception_obj) with a verification of immutability
185185
// that the object state is not being altered.
186186

187187
auto exception_type = reinterpret_cast<PyTypeObject*>(exception_obj->ob_type);

0 commit comments

Comments
 (0)