File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
scripts/pretty-printers/gdb Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,17 @@ def to_string(self):
2424 typed_pointer = "((const {} *){})" .format (self .val .type , raw_address .split (None , 1 )[0 ])
2525
2626 # Check that the pointer is not null.
27- if gdb .parse_and_eval (typed_pointer + " == 0" ):
27+ null_ptr = gdb .parse_and_eval ("{} == 0" .format (typed_pointer ))
28+ if null_ptr .is_optimized_out :
29+ return "<Ptr optimized out>"
30+ if null_ptr :
2831 return ""
2932
3033 # If it isn't attempt to find the string.
31- value = "(*{})" .format (typed_pointer )
32- return gdb .parse_and_eval (value + ".c_str()" )
34+ value = gdb .parse_and_eval ("{}->c_str()" .format (typed_pointer ))
35+ if value .is_optimized_out :
36+ return "<Optimized out>"
37+ return value
3338 except :
3439 return ""
3540
You can’t perform that action at this time.
0 commit comments