This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug breakpoints/11094] New: cannot reexecute programs using the GDB JIT interface in shared libs
- From: "edwintorok at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 15 Dec 2009 21:01:10 -0000
- Subject: [Bug breakpoints/11094] New: cannot reexecute programs using the GDB JIT interface in shared libs
- Reply-to: sourceware-bugzilla at sourceware dot org
When trying to debug a program (for example ClamAV) that uses the GDB JIT inside
a shared lib (for example LLVM in libclamavc++.so), then I cannot reexecute the
program.
This happens when no code was registered with the JIT interface, such as when I
simply put a breakpoint on main, and try to run twice, the 2nd run will fail
telling me it couldn't reset breakpoint -4 (or -2).
I've created a small testcase to show this problem (will attach), here is the
output:
--- shared.c:
#include <stdint.h>
typedef enum
{
JIT_NOACTION = 0,
JIT_REGISTER_FN,
JIT_UNREGISTER_FN
} jit_actions_t;
struct jit_code_entry
{
struct jit_code_entry *next_entry;
struct jit_code_entry *prev_entry;
const char *symfile_addr;
uint64_t symfile_size;
};
struct jit_descriptor
{
uint32_t version;
/* This type should be jit_actions_t, but we use uint32_t
to be explicit about the bitwidth. */
uint32_t action_flag;
struct jit_code_entry *relevant_entry;
struct jit_code_entry *first_entry;
};
/* GDB puts a breakpoint in this function. */
void __attribute__((noinline)) __jit_debug_register_code() { };
/* Make sure to specify the version statically, because the
debugger may check the version before we can set it. */
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
int foo() {
return 4;
}
--- bp_minus4.c:
int foo();
int main()
{
return foo();
}
gcc (Debian 4.4.2-5) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU gdb (GDB) 7.0-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/edwin/gdbbug/bp_minus4...done.
Breakpoint 1 at 0x4005f8: file bp_minus4.c, line 4.
Breakpoint 1, main () at bp_minus4.c:4
4 return foo();
/home/edwin/gdbbug/gdb.tmp:3: Error in sourced command file:
Warning:
Cannot insert breakpoint -2.
Error accessing memory address 0x7ffff7dfa5dc: Input/output error.
(gdb) maint info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000004005f8 in main at bp_minus4.c:4
-2 jit events keep y 0x00007ffff7dfa5dc
-9 shlib events keep y 0x000000381da0dcc0 <*__GI__dl_debug_state>
(gdb) quit
A debugging session is active.
Inferior 2 [process 18147] will be killed.
Quit anyway? (y or n) y
--
Summary: cannot reexecute programs using the GDB JIT interface in
shared libs
Product: gdb
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: breakpoints
AssignedTo: unassigned at sourceware dot org
ReportedBy: edwintorok at gmail dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=11094
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.