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

This is a discussion on How to specify a new but non-default path of gdb in gcc? - Linux ; Hi, 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 ...

+ Reply to Thread
Results 1 to 4 of 4

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

  1. How to specify a new but non-default path of gdb in gcc?

    Hi,

    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?

    Thanks!

    Best Regards,
    LaBird (Benny).
    [Email: Remove all numerals to get the correct address.]



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

    Hi again,

    An additional question: Is the debug information of "gcc -g" provided
    by gcc, or gcc needs to link to some existing gdb libraries for generating
    such debug info? (If the former case is the answer, I only need to
    compile the programs the same way, but invoke the new version of gdb
    during debugging.)

    Best Regards,
    LaBird (Benny).
    [Email: Remove all numerals to get the correct address.]


    "LaBird" wrote:
    > Hi,
    >
    > 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?
    >
    > Thanks!
    >
    > Best Regards,
    > LaBird (Benny).
    > [Email: Remove all numerals to get the correct address.]
    >




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

    "LaBird" 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.

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

    Hi Paul,

    Many thanks for clarifying!

    Best Regards,
    LaBird (Benny).
    [Email: Remove all numerals to get the correct address.]


    "Paul Pluzhnikov" wrote:
    > 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.




+ Reply to Thread