This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/11273] New: Make break without argument work in dynamic libraries
- From: "stephane dot chauveau at caps-entreprise dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 11 Feb 2010 15:24:45 -0000
- Subject: [Bug gdb/11273] New: Make break without argument work in dynamic libraries
- Reply-to: sourceware-bugzilla at sourceware dot org
The issue described below was tested on debian linux x86_64 with multiple
versions of gdb from 6.8 to 7.0.50.20100211 and multiple versions of gcc/g++
between 4.1 to 4.4.3
When restarting a program after setting some breakpoints in a shared library, I
often get the infamous error:
Warning:
Cannot insert breakpoint 2.
Error accessing memory address 0x7ffff7be07f2: Input/output error
Breakpoints sets by name (e.g. 'break myFunc') or by location ('break 10' or
'break mycode.c:10') are working fine. I just figured out that the ones causing
a problem are those set at a constant address (e.g. break *0x1234578). Those are
rare except for the special case of the 'break' command without argument that
adds a breakpoint at the current address in the frame.
Simply speaking, all breakpoints created with 'break' or its shortcut 'b' inside
a shared library cannot be reinserted by 'run'.
For peoples having the same problem, I propose a simple workaround. Add the
following lines to your .gdbinit to patch the 'b' command so that it executes
the almost equivalent command 'b +0' when executed without arguments. That
should work fine when debugging at source level. If needed, the original
behavior is still available with 'br' or 'break'.
define b
if $argc == 0
break +0
end
if $argc == 1
break $arg0
end
if $argc == 2
break $arg0 $arg1
end
if $argc == 3
break $arg0 $arg1 $arg2
end
end
--
Summary: Make break without argument work in dynamic libraries
Product: gdb
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: stephane dot chauveau at caps-entreprise dot com
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11273
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.