This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
src/gdb ChangeLog ada-tasks.c bsd-kvm.c corelo ...
- From: palves at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: Tue, 17 Sep 2013 18:26:41 +0000
- Subject: src/gdb ChangeLog ada-tasks.c bsd-kvm.c corelo ...
CVSROOT: /cvs/src
Module name: src
Changes by: palves@sourceware.org 2013-09-17 18:26:41
Modified files:
gdb : ChangeLog ada-tasks.c bsd-kvm.c corelow.c
frame.h infcmd.c inferior.c infrun.c
linux-fork.c record-full.c remote-mips.c
stack.c thread.c tracepoint.c
gdb/mi : mi-cmd-stack.c mi-interp.c mi-main.c
gdb/testsuite : ChangeLog
Added files:
gdb/testsuite/gdb.threads: info-threads-cur-sal-2.c
info-threads-cur-sal.c
info-threads-cur-sal.exp
Log message:
PR gdb/15911: "info threads" changes the default source and line (for "break", "list")
"info threads" changes the default source for "break" and "list", to
whatever the location of the first/bottom thread in the thread list
is...
(gdb) b start
(gdb) c
...
(gdb) list
*lists "start"*
(gdb) b 23
Breakpoint 3 at 0x400614: file test.c, line 23.
(gdb) info threads
Id Target Id Frame
* 2 Thread 0x7ffff7fcb700 (LWP 1760) "test" start (arg=0x0) at test.c:23
1 Thread 0x7ffff7fcc740 (LWP 1748) "test" 0x000000323dc08e60 in pthread_join (threadid=140737353922304, thread_return=0x0) at pthread_join.c:93
(gdb) b 23
Breakpoint 4 at 0x323dc08d90: file pthread_join.c, line 23.
^^^^^^^^^^^^^^^
(gdb) list
93 lll_wait_tid (pd->tid);
94
95
96 /* Restore cancellation mode. */
97 CANCEL_RESET (oldtype);
98
99 /* Remove the handler. */
100 pthread_cleanup_pop (0);
101
102
The issue is that print_stack_frame always sets the current sal to the
frame's sal. print_frame_info (which print_stack_frame calls to do
most of the work) also sets the last displayed sal, but only if
print_what isn't LOCATION. Now the call in question, from within
thread.c:print_thread_info, does pass in LOCATION as print_what, but
print_stack_frame doesn't have the same check print_frame_info has.
We could consider adding it, but setting these globals depending on
print_what isn't very clean, IMO. What we have is two logically
distinct operations mixed in the same function(s):
#1 - print frame, in the format specified by {print_what,
print_level and print_args}.
#2 - We're displaying a frame to the user, and I want the default
sal to point here, because the program stopped here, or the user
did some context-changing command (up, down, etc.).
So I added a new parameter to print_stack_frame & friends for point
#2, and went through all calls in the tree adjusting as necessary.
Tested on x86_64 Fedora 17.
gdb/
2013-09-17 Pedro Alves <palves@redhat.com>
PR gdb/15911
* ada-tasks.c (task_command_1): Adjust call to print_stack_frame.
* bsd-kvm.c (bsd_kvm_open, bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd):
* corelow.c (core_open):
* frame.h (print_stack_frame, print_frame_info): New
'set_current_sal' parameter.
* infcmd.c (finish_command, kill_command): Adjust call to
print_stack_frame.
* inferior.c (inferior_command): Likewise.
* infrun.c (normal_stop): Likewise.
* linux-fork.c (linux_fork_context): Likewise.
* record-full.c (record_full_goto_entry, record_full_restore):
Likewise.
* remote-mips.c (common_open): Likewise.
* stack.c (print_stack_frame): New 'set_current_sal' parameter.
Use it.
(print_frame_info): New 'set_current_sal' parameter. Set the last
displayed sal depending on the new paremeter instead of looking at
print_what.
(backtrace_command_1, select_and_print_frame, frame_command)
(current_frame_command, up_command, down_command): Adjust call to
print_stack_frame.
* thread.c (print_thread_info, restore_selected_frame)
(do_captured_thread_select): Adjust call to print_stack_frame.
* tracepoint.c (tfind_1): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_frame): Likewise.
* mi/mi-interp.c (mi_on_normal_stop): Likewise.
* mi/mi-main.c (mi_cmd_exec_return, mi_cmd_trace_find): Likewise.
gdb/testsuite/
* gdb.threads/info-threads-cur-sal-2.c: New file.
* gdb.threads/info-threads-cur-sal.c: New file.
* gdb.threads/info-threads-cur-sal.exp: New file.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.16002&r2=1.16003
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-tasks.c.diff?cvsroot=src&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/bsd-kvm.c.diff?cvsroot=src&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/corelow.c.diff?cvsroot=src&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/frame.h.diff?cvsroot=src&r1=1.210&r2=1.211
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infcmd.c.diff?cvsroot=src&r1=1.333&r2=1.334
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/inferior.c.diff?cvsroot=src&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infrun.c.diff?cvsroot=src&r1=1.590&r2=1.591
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/linux-fork.c.diff?cvsroot=src&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/record-full.c.diff?cvsroot=src&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/remote-mips.c.diff?cvsroot=src&r1=1.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/stack.c.diff?cvsroot=src&r1=1.279&r2=1.280
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/thread.c.diff?cvsroot=src&r1=1.156&r2=1.157
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/tracepoint.c.diff?cvsroot=src&r1=1.323&r2=1.324
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/mi/mi-cmd-stack.c.diff?cvsroot=src&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/mi/mi-interp.c.diff?cvsroot=src&r1=1.86&r2=1.87
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/mi/mi-main.c.diff?cvsroot=src&r1=1.240&r2=1.241
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3808&r2=1.3809
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.threads/info-threads-cur-sal-2.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.threads/info-threads-cur-sal.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp.diff?cvsroot=src&r1=NONE&r2=1.1