Skip to content

Commit dedbba4

Browse files
committed
Eliminate process running requirement of dump_bt in .gdbinit
Most of the time scope are avaible, but if not, it will be hard to get them, since we can't call function if no proccess running. try to get class name if we can.
1 parent 752280d commit dedbba4

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

.gdbinit

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,34 @@ define dump_bt
4747
if $fst.function.common.scope
4848
printf "%s->", $fst.function.common.scope->name
4949
else
50-
____executor_globals
51-
set $class_name_ptr = (char **)malloc(sizeof(char **))
52-
set $class_name_len = (int *)malloc(sizeof(int *))
53-
54-
if basic_functions_module.zts
55-
set $dup = zend_get_object_classname($t->object, $class_name_ptr, $class_name_len, $tsrm_ls)
56-
else
57-
set $dup = zend_get_object_classname($t->object, $class_name_ptr, $class_name_len)
50+
if !$eg && !basic_functions_module.zts
51+
____executor_globals
5852
end
5953

60-
printf "%s->", *$class_name_ptr
54+
set $known_class = 0
55+
if $eg
56+
set $handle = $t->object.value.obj.handle
57+
set $handlers = $t->object.value.obj.handlers
58+
set $zobj = (zend_object *)$eg.objects_store.object_buckets[$handle].bucket.obj.object
59+
60+
if $handlers->get_class_entry == &zend_std_object_get_class
61+
set $known_class = 1
62+
63+
if $handlers.get_class_name
64+
if $handlers.get_class_name != &zend_std_object_get_class_name
65+
set $known_class = 0
66+
end
67+
end
68+
69+
if $known_class
70+
printf "%s->", $zobj->ce.name
71+
end
72+
end
73+
end
6174

62-
if !$dup
63-
call _efree(*$class_name_ptr, "[GDB]", 0, "", 0)
75+
if !$known_class
76+
printf "Unknow->"
6477
end
65-
call (void) free($class_name_ptr)
66-
call (void) free($class_name_len)
6778
end
6879
else
6980
if $fst.function.common.scope

0 commit comments

Comments
 (0)