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):
24
24
typed_pointer = "((const {} *){})" .format (self .val .type , raw_address .split (None , 1 )[0 ])
25
25
26
26
# 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 :
28
31
return ""
29
32
30
33
# 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
33
38
except :
34
39
return ""
35
40
You can’t perform that action at this time.
0 commit comments