PR gdb/11568 is about thread-specific breakpoints being left behind
when the corresponding thread exits.
Currently:
(gdb) b start thread 2
Breakpoint 3 at 0x400614: file thread-specific-bp.c, line 23.
(gdb) b end
Breakpoint 4 at 0x40061f: file thread-specific-bp.c, line 29.
(gdb) c
Continuing.
[Thread 0x7ffff7fcb700 (LWP 14925) exited]
[Switching to Thread 0x7ffff7fcc740 (LWP 14921)]
Breakpoint 4, end () at thread-specific-bp.c:29
29 }
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7ffff7fcc740 (LWP 14921) "thread-specific" end () at thread-specific-bp.c:29
(gdb) info breakpoints
Num Type Disp Enb Address What
2 breakpoint keep y 0x0000000000400614 in start at thread-specific-bp.c:23
breakpoint already hit 1 time
3 breakpoint keep y 0x0000000000400614 in start at thread-specific-bp.c:23 thread 2
stop only in thread 2
4 breakpoint keep y 0x000000000040061f in end at thread-specific-bp.c:29
breakpoint already hit 1 time
Note that the thread-specific breakpoint 3 stayed around, even though
thread 2 is gone.
There's no way that breakpoint can trigger again (*), so the PR argues
that the breakpoint should just be removed, like local watchpoints.
I'm ambivalent on this -- it could be reasonable to disable the
breakpoint (kind of like breakpoint in shared library code when the
DSO is unloaded), so the user could still use it as visual template
for creating other breakpoints (copy/paste command lists, etc.), or we
could have a way to change to which thread a breakpoint applies. But,
several people pushed this direction, and I don't plan on arguing...
(*) - actually, there is ... thread numbers are reset on "run", so
the user could do "break foo thread 2", "run", and expect the
breakpoint to hit again on the second thread. But given gdb's thread
numbering can't really be stable, that'd only work sufficiently well
for thread 1, so we'd better call it unsupported.
So with the patch, whenever a thread is deleted from GDB's list, GDB
goes through the thread-specific breakpoints and deletes corresponding
breakpoints. Since this is user-visible, GDB prints out:
Thread-specific breakpoint 3 deleted - thread 2 is gone.
And of course, we end up with:
(gdb) info breakpoints
Num Type Disp Enb Address What
2 breakpoint keep y 0x0000000000400614 in start at thread-specific-bp.c:23
breakpoint already hit 1 time
4 breakpoint keep y 0x000000000040061f in end at thread-specific-bp.c:29
breakpoint already hit 1 time
2013-09-17 Muhammad Waqas <mwaqas@codesourcery.com>
Pedro Alves <palves@redhat.com>
PR gdb/11568
* breakpoint.c (remove_threaded_breakpoints): New function.
(_initialize_breakpoint): Attach remove_threaded_breakpoints
as thread_exit observer.
2013-09-17 Muhammad Waqas <mwaqas@codesourccery.com>
Jan Kratochvil <jan.kartochvil@redhat.com>
Pedro Alves <palves@redhat.com>
PR gdb/11568
* gdb.thread/thread-specific-bp.c: New file.
* gdb.thread/thread-specific-bp.exp: New file.
function. It adds a check for $_isvoid during the test of "show convenience"
output.
gdb/testsuite/
2013-09-17 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/defaults.exp (<show_conv_list>): Add check for $_isvoid
convenience function.
"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.
* gdb.base/catch-load.c: Remove the include of "dlfcn.h".
[__WIN32__]: Include "windows.h" and define macro dlopen
and dlclose.
[!__WIN32__]: Include "dlfcn.h".
* gdb.base/catch-load.exp (one_catch_load_test): Match
directory separator.
"You should provide one parameter..." while it should be saying "... one
argument...". Replaced.
2013-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* value.c (isvoid_internal_fn): Replace "parameter" with
"argument".
<https://sourceware.org/ml/gdb-patches/2013-09/msg00301.html>
<https://sourceware.org/ml/gdb-patches/2013-09/msg00383.html>
This patch adds a new convenience function called $_isvoid, whose
only purpose is to check whether an expression is void or not.
This became necessary because the new convenience variable
$_exitsignal (not yet approved) has a mutual exclusive behavior
with $_exitcode, i.e., when one is "defined" (i.e., non-void),
the other is cleared (i.e., becomes void). Doug wanted a way to
identify which variable to use, and checking for voidness is the
obvious solution.
It is worth mentioning that my first attempt, after a conversation with
Doug, was to actually implement a new $_isdefined() convenience
function. I would do that (for convenience variables) by calling
lookup_only_internalvar. However, I found a few problems:
- Whenever I called $_isdefined ($variable), $variable became defined
(with a void value), and $_isdefined always returned true.
- Then, I tried to implement $_isdefined ("variable"), and do the "$" +
"variable" inside GDB, thus making it impossible for GDB to create the
convenience variable. However, it was hard to extract the string
without having to mess with values and their idiossincrasies.
Therefore, I decided to abandon this attempt (specially because I
didn't want to spend too much time struggling with it).
Anyway, after talking to Doug again we decided that it would be easier
to implement $_isvoid, and this will probably help in cases like
<http://stackoverflow.com/questions/3744554/testing-if-a-gdb-convenience-variable-is-defined>.
I wrote a NEWS entry for it, and some new lines on the documentation.
gdb/
2013-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* NEWS: Mention new convenience function $_isvoid.
* value.c (isvoid_internal_fn): New function.
(_initialize_values): Add new convenience function $_isvoid.
gdb/doc/
2013-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.texinfo (Convenience Functions): Mention new convenience
function $_isvoid.
gdb/testsuite/
2013-09-16 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/gdbvars.c (foo_void): New function.
(foo_int): Likewise.
* gdb.base/gdbvars.exp (test_convenience_functions): New
function. Call it.
Apply the same fix that was applied to aarch64-linux-nat.c.
2013-09-16 Will Newton <will.newton@linaro.org>
* linux-aarch64-low.c (aarch64_linux_set_debug_regs): Zero
out regs.
Remove AT_HWCAP macro definintion as it is provided in
added include file.
* s390-tdep.c: Remove system header <elf.h>
Add "elf/common.h" header for AT_HWCAP definition.
(s390_core_read_description): Use correct CORE_ADDR
for hwcap local variable used as third parameter
of function target_auxv_search.
The existing code would accept VLD2.64 and similar undefined
instructions.
gas/ChangeLog:
2013-09-16 Will Newton <will.newton@linaro.org>
* config/tc-arm.c (do_neon_ld_st_interleave): Add constraint
disallowing element size 64 with interleave other than 1.
gas/testsuite/ChangeLog:
2013-09-16 Will Newton <will.newton@linaro.org>
* gas/arm/neon-ldst-es.d: Add VLD1.64 instructions.
* gas/arm/neon-ldst-es.s: Likewise.
* testsuite/gas/arm/neon-ldst-es-bad.d: New file.
* testsuite/gas/arm/neon-ldst-es-bad.l: Likewise.
* testsuite/gas/arm/neon-ldst-es-bad.s: Likewise.
gdb/
2013-09-13 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
* symfile.c (reread_symbols): Move variable obfd_filename to a more
inner block.
Corrected mi documentation about -list-target-features, example now uses the
correct mi command.
2013-09-13 Sanimir Agovic <sanimir.agovic@intel.com>
* gdb.texinfo (GDB/MI Miscellaneous Commands): Use
-list-target-features in the example.
gdb/doc/
2013-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (MiniDebugInfo): Prepare file debug and use it to create
mini_debuginfo. Strip binary before adding mini_debuginfo to it.
gdb/testsuite/
2013-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/gnu-debugdata.exp (objcopy 1): Move it lower and use only
debug part of the binary.
gdb/doc/
2013-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
Sync documentation with gdb.base/gnu-debugdata.exp.
* gdb.texinfo (MiniDebugInfo): Add comment and "D" in the example.
New regexpr now correctly deals with trailing canonical pathname.
Before only the following output was matched:
(gdb) cd
Working directory /users/foo
In addition it now matches an optional trailing canonical pathname:
(gdb) cd
Working directory /users/foo
(canonically /nfs/users/foo).
Triggered by `realpath .` != `pwd`
2013-09-10 Sanimir Agovic <sanimir.agovic@intel.com>
testsuite/
* gdb.base/default.exp: Adjust regexpr for 'cd' to match optional
canonical pathname.