MCPcopy Create free account
hub / github.com/apache/arrow / for_evaluation

Function for_evaluation

cpp/gdb_arrow.py:115–134  ·  view source on GitHub ↗

Return a parsable form of gdb.Value `val`, optionally with gdb.Type `ty`.

(val, ty=None)

Source from the content-addressed store, hash-verified

113
114
115def for_evaluation(val, ty=None):
116 """
117 Return a parsable form of gdb.Value `val`, optionally with gdb.Type `ty`.
118 """
119 if ty is None:
120 ty = get_basic_type(val.type)
121 typename = str(ty) # `ty.name` is sometimes None...
122 if '::' in typename and not typename.startswith('::'):
123 # ARROW-15652: expressions evaluated by GDB are evaluated in the
124 # scope of the C++ namespace of the currently selected frame.
125 # When inside a Parquet frame, `arrow::<some type>` would be looked
126 # up as `parquet::arrow::<some type>` and fail.
127 # Therefore, force the lookup to happen in the global namespace scope.
128 typename = f"::{typename}"
129 if ty.code == gdb.TYPE_CODE_PTR:
130 # It's already a pointer, can represent it directly
131 return f"(({typename}) ({val}))"
132 if val.address is None:
133 raise ValueError(f"Cannot further evaluate rvalue: {val}")
134 return f"(* ({typename}*) ({val.address}))"
135
136
137def is_char_star(ty):

Callers 10

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
eval_atMethod · 0.85
iter_evalMethod · 0.85
to_stringMethod · 0.85
_for_evaluationMethod · 0.85
_for_evaluationMethod · 0.85
_format_detailMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected