Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit 4a6a1ed

Browse files
author
Yao Qi
committed
Fix GDB crash in dprintf.exp
I see GDB crashes in dprintf.exp on aarch64-linux testing, (gdb) PASS: gdb.base/dprintf.exp: agent: break 29 set dprintf-style agent^M (gdb) PASS: gdb.base/dprintf.exp: agent: set dprintf style to agent continue^M Continuing. ASAN:SIGSEGV ================================================================= ==22475==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x000000494820 sp 0x7fff389b83a0 bp 0x62d000082417 T0) #0 0x49481f in remote_add_target_side_commands /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:9190^M #1 0x49e576 in remote_add_target_side_commands /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:9174^M #2 0x49e576 in remote_insert_breakpoint /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:9240^M #3 0x5278b7 in insert_bp_location /home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:2734^M #4 0x52ac09 in insert_breakpoint_locations /home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:3159^M #5 0x52ac09 in update_global_location_list /home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:12686 the root cause of this problem in this case is about linespec and symtab which produces additional incorrect location and a NULL is added to bp_tgt->tcommands. I posted a patch https://sourceware.org/ml/gdb-patches/2015-12/msg00321.html to fix it in linespec (the fix causes regression), but GDB still shouldn't add NULL into bp_tgt->tcommands. The logic of build_target_command_list looks odd to me. If we get something wrong in parse_cmd_to_aexpr (it returns NULL), we shouldn't continue, instead we should set flag null_command_or_parse_error. This is what this patch does. In the meantime, we find build_target_condition_list has the same problem, so fix it too. gdb: 2016-01-28 Yao Qi <[email protected]> * breakpoint.c (build_target_command_list): Don't call continue if aexpr is NULL. (build_target_condition_list): Likewise.
1 parent 8926d5a commit 4a6a1ed

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

gdb/ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2016-01-28 Yao Qi <[email protected]>
2+
3+
* breakpoint.c (build_target_command_list): Don't call continue
4+
if aexpr is NULL.
5+
(build_target_condition_list): Likewise.
6+
17
2016-01-27 Kevin Buettner <[email protected]>
28

39
* rx-tdep.c (rx_push_dummy_call): Treat scalars larger than 8

gdb/breakpoint.c

-9
Original file line numberDiff line numberDiff line change
@@ -2347,12 +2347,6 @@ build_target_condition_list (struct bp_location *bl)
23472347
need to parse the condition to bytecodes again. */
23482348
aexpr = parse_cond_to_aexpr (bl->address, loc->cond);
23492349
loc->cond_bytecode = aexpr;
2350-
2351-
/* Check if we managed to parse the conditional expression
2352-
correctly. If not, we will not send this condition
2353-
to the target. */
2354-
if (aexpr)
2355-
continue;
23562350
}
23572351

23582352
/* If we have a NULL bytecode expression, it means something
@@ -2553,9 +2547,6 @@ build_target_command_list (struct bp_location *bl)
25532547
aexpr = parse_cmd_to_aexpr (bl->address,
25542548
loc->owner->extra_string);
25552549
loc->cmd_bytecode = aexpr;
2556-
2557-
if (!aexpr)
2558-
continue;
25592550
}
25602551

25612552
/* If we have a NULL bytecode expression, it means something

0 commit comments

Comments
 (0)