aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorPuputti, Matti <matti.puputti@intel.com>2023-07-26 12:29:15 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-08-16 09:55:52 +0100
commitda1f552dc79476275af282b65c5317ab3b4dbd9a (patch)
treeae9eb538fb263b9ce15654b44cf868e47923d6a7 /gdb/infcmd.c
parentba22cd5e8852a3ad0a94fc268dbd244eb0aae4e7 (diff)
downloadgdb-da1f552dc79476275af282b65c5317ab3b4dbd9a.zip
gdb-da1f552dc79476275af282b65c5317ab3b4dbd9a.tar.gz
gdb-da1f552dc79476275af282b65c5317ab3b4dbd9a.tar.bz2
gdb, infcmd: support jump command in multi-inferior case
Fixes the issue where jump failed if multiple inferiors run the same source. See the below example $ gdb -q ./simple Reading symbols from ./simple... (gdb) break 2 Breakpoint 1 at 0x114e: file simple.c, line 2. (gdb) run Starting program: /temp/simple Breakpoint 1, main () at simple.c:2 2 int a = 42; (gdb) add-inferior [New inferior 2] Added inferior 2 on connection 1 (native) (gdb) inferior 2 [Switching to inferior 2 [<null>] (<noexec>)] (gdb) info inferiors Num Description Connection Executable 1 process 6250 1 (native) /temp/simple * 2 <null> 1 (native) (gdb) file ./simple Reading symbols from ./simple... (gdb) run Starting program: /temp/simple Thread 2.1 "simple" hit Breakpoint 1, main () at simple.c:2 2 int a = 42; (gdb) info inferiors Num Description Connection Executable 1 process 6250 1 (native) /temp/simple * 2 process 6705 1 (native) /temp/simple (gdb) jump 3 Unreasonable jump request (gdb) In this example, jump fails because the debugger finds two different locations, one for each inferior. Solution is to limit the search to the current program space. This is done by having the jump_command function use decode_line_with_current_source rather than decode_line_with_last_displayed, which makes sense, the *_current_source function always looks up a location based on the current thread's location -- if a user is asking the current thread to jump, then surely their destination should be relative to where the current thread is located. Then, inside decode_line_with_current_source, the call to decode_line_1 is updated to pass through the current program_space, which will limit the returned locations to those in the current program space. Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 15702f8..96c5fea 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1068,7 +1068,7 @@ jump_command (const char *arg, int from_tty)
error_no_arg (_("starting address"));
std::vector<symtab_and_line> sals
- = decode_line_with_last_displayed (arg, DECODE_LINE_FUNFIRSTLINE);
+ = decode_line_with_current_source (arg, DECODE_LINE_FUNFIRSTLINE);
if (sals.size () != 1)
{
/* If multiple sal-objects were found, try dropping those that aren't