This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
bug fix for gdb 16039 ( patch resent according Sergion's suggestion)
- From: "Dave.Tian" <xhengdf at gmail dot com>
- To: gdb-patches at sourceware dot org
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>
- Date: Mon, 14 Oct 2013 02:32:23 -0500
- Subject: bug fix for gdb 16039 ( patch resent according Sergion's suggestion)
- Authentication-results: sourceware.org; auth=none
1 description: gdb bug 16039 created by me
Title: gdb next" command stop working when shared library unloaded
Root Cause: there is "libc++" static linked into the shared library,
and since gdb insert internal breakpoints on
std::terminate/longjump/..
so after dlclose, the memory address is invalid,
remove_breakpoints/insert_breakpoints failed with EIO error.
Fix: disable the internal breakpoints when dlclose hit.
2 ChangeLog:
PR gdb/16039
* breakpoint.c (set_longjmp_breakpoint): Check if breakpoint's
location address is not in an unloaded shared library.
(disable_breakpoints_in_unloaded_shlib):
disable the internal breakpoints in the hook function of shared
library unload.
3 Patch diffs:
--- breakpoint.c.bak 2013-10-12 01:15:09.044081000 -0700
+++ breakpoint.c 2013-10-13 22:56:54.905407000 -0700
@@ -1118,6 +1118,15 @@ is_tracepoint (const struct breakpoint *
return is_tracepoint_type (b->type);
}
+static int
+is_internal_breakpoint (const struct breakpoint *b)
+{
+ return (b->type == bp_longjmp_master
+ || b->type == bp_std_terminate_master
+ || b->type == bp_exception_master
+ || b->type == bp_exception);
+}
+
/* A helper function that validates that COMMANDS are valid for a
breakpoint. This function will throw an exception if a problem is
found. */
@@ -7147,8 +7156,8 @@ set_longjmp_breakpoint (struct thread_in
clones of those and enable them for the requested thread. */
ALL_BREAKPOINTS_SAFE (b, b_tmp)
if (b->pspace == current_program_space
- && (b->type == bp_longjmp_master
- || b->type == bp_exception_master))
+ && ((b->type == bp_longjmp_master
+ || b->type == bp_exception_master) && !b->loc->shlib_disabled))
{
enum bptype type = b->type == bp_longjmp_master ? bp_longjmp : bp_exception;
struct breakpoint *clone;
@@ -7463,7 +7472,8 @@ disable_breakpoints_in_unloaded_shlib (s
|| b->type == bp_hardware_breakpoint)
&& (loc->loc_type == bp_loc_hardware_breakpoint
|| loc->loc_type == bp_loc_software_breakpoint))
- || is_tracepoint (b))
+ || is_tracepoint (b)
+ || is_internal_breakpoint (b))
&& solib_contains_address_p (solib, loc->address))
{
loc->shlib_disabled = 1;
thank you,
-YT