Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Debug source lookup question

On Thursday 20 November 2008 17:07:10 Mikhail Khodjaiants wrote:
> Sorry James, my example is not correct. The correct paths are
> "/project/foo/../main.c" and "/project/main.c". The point is that both
> represent the same file, but from the GDB's point of view there are
> different.

Not necessary. On Linux, GDB uses realpath, so it does not care much
how you specify the file. On Windows, this is not the case now -- I've posted
a patch to fix it, but it's not in GDB CVS. 

>
> > A better solution might be to look in the binary and check whether
>
> there are any source file collisions before attempting to set
> breakpoints.
>
> That's what I am proposing, but instead of parsing the binary, we let
> GDB to do the work and retrieve the list of source files and their paths
> from GDB. In this case we can use absolute paths to set breakpoints. If
> we need to set a breakpoint at "/project/main.c" the source lookup will
> translate the path to "/project/foo/../main.c" and GDB will understand
> it.

I'm getting confused. What problem is solved by getting the list of
source files from GDB? Assuming the GDB issue with full paths on Windows is
fixed, you can just *always* send full path when setting a breakpoint.

Using the list of source paths from GDB to filter breakpoints does not seem 
necessary, either -- if GDB does not know about a source file, it won't set
a breakpoint -- there's no need to do such filtering on CDT side. Note also 
that in presense of shared libraries, including on-demand loaded ones, the
list of source paths becomes undefined notion.

- Volodya



Back to the top