Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] breakpoints with basename

Here is a little update regarding gdb and gcc behaviour.
We attempt to submit patch to gdb that would canonicalize file names before
comparing so "/project/dir/../foo.c" and "/project/foo.c" be counted as the
same, there is long thread about it, and at the end they rejected the patch
and agreement was that gcc should not create such paths in the binary. So if
you using gcc 4.2.1 you should be fine. Also it may be file with 3.3.5 as
well but it depends on exact way of compiling. 

I created an option to enable setting breakpoints by full file name,
patch is available in pr
If somebody think it is useful you can apply it to 5.0 (I did it for 4, it
is not matching I can redo it)

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
Behalf Of Mikhail Khodjaiants
Sent: February 23, 2008 9:30 AM
To: CDT General developers list.
Subject: RE: [cdt-dev] breakpoints with basename

GDB manages file names as strings. That's why "/project/dir/../foo.c"
and "/project/foo.c" are different files from the GDB's point of view.
The file names are extracted from executables and are put there by
compilers, GDB just reads the debug information.
If you try to set a breakpoint at foo.c using the full path
"/project/foo.c" and the executable contains "/project/dir/../foo.c" you
will get an error.
I only learned it from Daniel Jacobowitz last year (not sure that it has
been fixed by GDB). Before that the problems with breakpoints kept
appearing randomly without visible patterns. That's why we decided to
use filenames instead of paths. 
>From my point of view the only way to deal with this situation is to
create a special source locator that reads the sources from GDB and maps
the canonical paths to the paths understandable by GDB and vice versa. 
This also applies to other debuggers because they have to deal with the
same executables, so creating a generic source container of this type is
worth to consider. I haven't implemented it yet for our debugger but
have been thinking of making it generic and contributing it to CDT.
BTW, this problem was mentioned at the DSF meeting in Ottawa last
September and I believe it has been mentioned recently in one of the
DSDP/DD mailing list discussions.
Not sure though that adding an option will help. It would make the
situation even more confusing.

Mikhail Khodjaiants
ARM Limited
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Elena Laskavaia
Sent: Friday, February 22, 2008 7:02 PM
To: 'CDT General developers list.'
Subject: [cdt-dev] breakpoints with basename

Currently with gdb debugger IDE sets breakpoints by basename of file
which creates a lot of problems for our customers because they use files
with a same base names in their project. 
Is there any option to turn this off and use full path names for setting
breakpoints (they do compile on the same host as debug)? If not is there
recommendation how to do it? Does anybody solve this problem for other
debugger? There only thing I can think right now is to add an option to
launch config for gdb for that. 
What has been done in dsdp about it?

cdt-dev mailing list

IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended
recipient, please notify the sender immediately and do not disclose the
contents to any other person, use it for any purpose, or store or copy the
information in any medium.  Thank you.

cdt-dev mailing list

Back to the top