Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Setting Breakpoints symbolically? (in gdb/DSF)

Hi Marc,

On 06/13/2011 04:53 PM, Marc Khouzam wrote:

 2- In your .gdbinit file, use the directory command:

it seems to me that `directory` setting works for finding the location of the source file when gdb stops on a certain breakpoint. But the translation is only one way, afaict. I.e. if you create a breakpoint using `b MyClass::MyFunction` and the sources on the host system are on a different path than when they were compiled on the debugging target system (running gdbserver), in this case directory may help.

But in my experience, it does not work the other way 'round, i.e. when setting a breakpoint with the host system's full path, the gdbserver wouldn't find the location in the binary to set the breakpoint.

That's why I was looking for a way to either shorten the breakpoint specification to a path relative to the project directory or set the breakpoints by symbol/function name.

Any pointers on that?

Thanks,

Dominik



On 06/13/2011 04:53 PM, Marc Khouzam wrote:
Sorry, Outlook decided to send the email without asking me.
I should be possible for GDB to set the breakpoint using the file
path on the local file system.
However, GDB must know where the source code is.  If you have moved
your binary on the local FS
from where it was compiled to a new location, you have to tell GDB
where the source code is.
You can try different things.
1- Use the binary in the location where it was compiled with respect
to the source code
2- In your .gdbinit file, use the directory command:
  directory <full path to source code>
3- Type #2 by hand in the gdb console
Marc
------------------------------------------------------------------------
*From:* cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx] *On Behalf Of *Dominik Röttsches
*Sent:* Monday, June 13, 2011 8:00 AM
*To:* cdt-dev@xxxxxxxxxxx
*Subject:* [cdt-dev] Setting Breakpoints symbolically? (in gdb/DSF)

        Hi,

        when I look at the gdb and gdb-traces consoles when debugging
        in conjunction with a remote gdb-server target, I see that the
        breakpoints are sent to gdbserver via:
        [...] break-insert
        /path/to/the/file/on/my/local/system/myProject/mySubDir/sourcefile:79


        I.e. it tries to set breakpoints by local file path and line
        number.

        Is it possible to either
        a) just set the breakpoint symbolically? I.e. 'break-insert
        Namespace::Class::MyFunction'
        b) strip the local-system parts of the path, i.e. only set
        breakpoint by "myProject/mySubDir/sourcefile:79"

        In the current way, in a remote debugging setup, gdbserver
        does not accept the breakpoint specification containing the
        full local path and the debugging session cannot be created.
        However, when I manually add such a symbolic breakpoint in the
        gdb console, it's possible to set it symbolically.

        Thanks for your help,

        Dominik


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


--
Dominik Röttsches<dominik.rottsches@xxxxxxxxxxxxxxxx>
Linux Software Engineer
Intel Finland Oy (OTC, SSD)



Back to the top