0

I am trying to compile and debug my code, runs on gcc 4.8.1 and using gdb version 7.5.1.

I am not sure what is causing this error, I cannot set a breakpoint or use start on gdb, all of them give the same (similar) error: Error in re-setting breakpoint 1: Cannot access memory at address 0xe0b01c

I saw this answer gdb error in re-settings breakpoint (cannot access memory), but i am not using -fPIE, I am using -fPIC though, and 7.7.1 has same issue.

Is this issue due to gdb/gcc version or some flags? I am using: -g -std=c++1 -D__GCC_EXPERIMENTAL_CXX0X__=1

Community
  • 1
  • 1
Rohit
  • 1
  • 1
  • 2

1 Answers1

0

Is this issue due to gdb/gcc version or some flags?

You didn't say whether you are setting breakpoint in the main executable, or in a shared library. The address: 0xe0b01c looks like it came from a shared library or a PIE executable.

In any case, GCC version has nothing to do with this, but your GDB is quite old.

The standard solution is to use (gdb) start, then enable to re-enable the breakpoint (by the time you stop on main, the PIE executable and all directly-linked shared libraries have been relocated to their final addresses).

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • I did try running (gdb) start , which puts a temporary breakpoint and never hits it. Temporary breakpoint 2 at 0xe0a982: file main.cc, line 106 Error in re-setting breakpoint 1: Cannot access memory at address 0xe0a960 . None of the breakpoints i set hit . – Rohit Jun 20 '16 at 14:26