This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
How important is the 'dir' command for a frontend?
- From: "Marc Khouzam" <marc dot khouzam at ericsson dot com>
- To: <gdb at sourceware dot org>
- Date: Fri, 26 Jun 2009 15:54:16 -0400
- Subject: How important is the 'dir' command for a frontend?
Hi,
I've resurrected an old Eclipse issue with GDB about
source and breakpoint mapping.
We are discussing things in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=225805
and have come to the point of not understanding GDB's behaviour.
So, here I am :-)
In Eclipse, we don't need to use GDB to list source code (with
the 'list' command). So we are wondering if we must use
the 'dir' command (-environement-directory) at all. (Using
'dir' can cause a lot of performance problems for very large
projects.)
It seemed ok until we found that when source code has been
moved, 'dir' is necessary to allow GDB to properly set breakpoints.
For example:
> 12-break-insert /home/marc/b.cc:11
> &"No source file named /home/marc/b.cc.\n"
> 12^error,msg="No source file named /home/marc/b.cc."
> 13-environment-directory /home/marc
> 13^done,source-path="/home/marc:$cdir:$cwd"
> 14-break-insert /home/marc/b.cc:11
>
14^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr=
"0x080484c8",func="m\
> ain",file="b.cc",fullname="/home/marc/b.cc",line="11",times="0"}
One suggestion was that Eclipse could always send the -env-dir
command before each -break-insert. Not very nice for the frontend,
but it made me wonder why GDB couldn't do it itself?
If a bp is requested on /home/marc/b.cc, why couldn't GDB
automatically use /home/marc as a source dir if it can't find
the absolute path in the binary?
I'm sure the issue is more complex that I think, but I thought
I would benefit greatly from a little guidance.
Thanks in advance
marc