Return a parsable form of gdb.Value `val`, optionally with gdb.Type `ty`.
(val, ty=None)
| 113 | |
| 114 | |
| 115 | def 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 | |
| 137 | def is_char_star(ty): |
no outgoing calls
no test coverage detected