This is the mail archive of the
mailing list for the GDB project.
gdb/2540: GDB needs a --sysroot command line option
- From: psmith at gnu dot org
- To: gdb-gnats at sources dot redhat dot com
- Date: 21 Oct 2008 21:59:56 -0000
- Subject: gdb/2540: GDB needs a --sysroot command line option
- Reply-to: psmith at gnu dot org
>Synopsis: GDB needs a --sysroot command line option
>Arrival-Date: Tue Oct 21 22:08:01 UTC 2008
Most of the GCC suite now takes a --sysroot command line argument specifying where to look for the system headers, libraries, etc. GDB has a new "set sysroot" command which does the same thing, and that's very handy. However, GDB really needs this to be available as a command-line option as well.
The problem is that if I run "gdb <targ> <core>" it will try to read the various libraries, etc. before I get any command-line prompt, and it will of course fail because the ones it finds are not the right sysroot ones. Only after I get a long list of error messages do I get a prompt and the ability to "set sysroot ..." whereupon GDB can now find the right libraries etc.
Even if I try something like "gdb -ex 'set sysroot ...' <targ> <core>" it won't help, because GDB will internalize the executable and core before running the set sysroot command.
What I would really like is a --sysroot=... option to GDB, just like I have for GCC. In this case GDB can see that option and process it first, before it tries to read in the exec file or the core file. This will keep everything loading in the right order and avoid lots of warnings and error messages.