Re: How to specify a new but non-default path of gdb in gcc?



"LaBird" <wlcheung1975@xxxxxxxxx> writes:

I have installed a new gdb (6.6) in my own (normal user) account,
under /home/username/gdb/. The system already has one older
version of gdb, but I'd like to try out the new one without removing
the old one. The installation is successful, but instead of "gcc -g ...",
what should I put in the command line when compiling a C program,
so that the debug information of the new gdb can be added instead
of the default old version?

You are confused: the way your program is compiled, and which
debugger you use to debug it, are completely independent [1].

The "debug info of the new gdb" (or any gdb) is certainly *not*
added to your executable.

You do not need to recompile your program to debug it with your
new debugger. Just do

~/gdb/gdb /path/to/executable

Cheers,

[1] Except older debugger may not understand debug format of the
newer gcc version.
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.



Relevant Pages

  • Re: seg fault
    ... I've never used a debugger, ever, but I thought I'd give this a go. ... First problem was to get gdb for Windows, but 10-15 mins on google and ... or -ggdb switches I use for gcc. ... where bugs could be due also to errors in the compiler, ...
    (comp.lang.c)
  • Re: Firewire blues
    ... I compiled a kernel with exactly the same options that you cited below. ... it entering the debugger and waiting for the remote gdb attach. ... When I try to attach from the debug machine, ...
    (freebsd-hackers)
  • Re: seg fault
    ... I've never used a debugger, ever, but I thought I'd give this a go. ... First problem was to get gdb for Windows, but 10-15 mins on google and ... or -ggdb switches I use for gcc. ... The -o switch instructs gcc to place it's output in a file whose name is ...
    (comp.lang.c)
  • Re: DDD debugger problem
    ... Ioannis Hadjichambis wrote: ... > I am trying to debug my program using the DDD debugger. ... > (gdb) set args ...
    (comp.lang.c)
  • Re: dde Debug message
    ... The DDE is the absolute worst debugger I have ever used. ... it is the only one that can debug MT apps on hpux 10.20 ... The other thing you can do is run the app under gdb until it SIGSERVs ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)