Skip to content

Commit 0e940e8

Browse files
committed
php_gdb: Handle NULL in format_zstr
1 parent 265cd54 commit 0e940e8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

main/debug_gdb_scripts.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,9 @@ asm(
16311631
".ascii \" return ary_type.fields()[0].type.range()[1]+1\\n\"\n"
16321632
".ascii \"\\n\"\n"
16331633
".ascii \"def format_zstr(zstr):\\n\"\n"
1634+
".ascii \" if zstr.type.code == gdb.TYPE_CODE_PTR and int(zstr) == 0:\\n\"\n"
1635+
".ascii \" return zstr\\n\"\n"
1636+
".ascii \"\\n\"\n"
16341637
".ascii \" len = int(zstr['len'])\\n\"\n"
16351638
".ascii \" truncated = False\\n\"\n"
16361639
".ascii \" if len > 200:\\n\"\n"

scripts/gdb/php_gdb.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,9 @@ def array_size(ary_type):
961961
return ary_type.fields()[0].type.range()[1]+1
962962

963963
def format_zstr(zstr):
964+
if zstr.type.code == gdb.TYPE_CODE_PTR and int(zstr) == 0:
965+
return zstr
966+
964967
len = int(zstr['len'])
965968
truncated = False
966969
if len > 200:

0 commit comments

Comments
 (0)