This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/11587] New: "Cannot insert breakpoint" on second run when __jit_debug_register_code() defined in shared library


jyasskin@enki:~/tmp$ cat jit_register.c 
void __attribute__((noinline)) __jit_debug_register_code() { };
jyasskin@enki:~/tmp$ cat test.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;
};

/* 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 main() {
  return 0;
}
jyasskin@enki:~/tmp$ gcc -shared -fPIC jit_register.c -o libjit_register.so
jyasskin@enki:~/tmp$ gcc test.c -ljit_register -L. -Wl,-rpath,. -o test
jyasskin@enki:~/tmp$ gdb test
GNU gdb (GDB) 7.1-gg2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Type "show copying" and "show warranty" for licensing/warranty details.
This GDB was configured as "x86_64-linux".

Reading symbols from /home/jyasskin/tmp/test...done.
(gdb) start
Temporary breakpoint 1 at 0x40056c
Starting program: /home/jyasskin/tmp/test 
warning: no loadable sections found in added symbol-file /usr/lib/debug/lib/ld-2.7.so

Temporary breakpoint 1, 0x000000000040056c in main ()
(gdb) start
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Temporary breakpoint 2 at 0x40056c
Starting program: /home/jyasskin/tmp/test 
warning: no loadable sections found in added symbol-file /usr/lib/debug/lib/ld-2.7.so
Warning:
Cannot insert breakpoint -2.
Error accessing memory address 0x7ffff7bdf50c: Input/output error.

(gdb) # From here on, gdb can't do anything with the program.
(gdb) maint info break
Num     Type           Disp Enb Address            What
-2      jit events     keep y   0x00007ffff7bdf50c  inf 1
2       breakpoint     del  y   0x000000000040056c <main+4> inf 1
-9      shlib events   keep y   0x00007ffff7dee9b0 <_dl_debug_state> inf 1

-- 
           Summary: "Cannot insert breakpoint" on second run when
                    __jit_debug_register_code() defined in shared library
           Product: gdb
           Version: 7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jyasskin at gmail dot com
                CC: gdb-prs at sourceware dot org,ppluzhnikov at google dot
                    com,reid dot kleckner at gmail dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11587

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]