Re: [RFC] GDB ARIndex Linux rule cleanup

Ulrich Weigand
2009-04-15T15:23:29Z

Eli Zaretskii wrote:

> I think GDB's "target" is always the OS kernel, not the OS itself.
>
> The distinction FSF asks for is between the GNU/Linux as a whole
> system, which includes all the main applications and libraries, and
> Linux as the bare-bones OS. GDB targets the latter, not the former.

Huh? I'd say a large part of what makes up a GDB target is unrelated
to the OS kernel:
- Processor properties (register names/types/groups)
- ABI elements (data types, function calling convention, stack unwinding,
C++ ABI, platform-specific debug format details, ...)
- Shared library support, thread support (those may depend on kernel
details, but may also -in particular on Linux- depend on strictly
user-space library-implemented details ...)

If you were to write a program using a completely different user-space
ABI, it might run just fine on the Linux kernel, but GDB configured
for a -linux target would not really be able to successfully debug the
program.

It seems to me that configuring GDB for, say, the powerpc-linux target,
has the effect of preparing GDB to debug programs on the GNU/Linux OS
on the PowerPC platform, assuming the GNU/Linux ABI for the platform
as well as the core GNU/Linux system libraries (libc, ld.so, libpthread)
to be used, of course *in addition* to the Linux kernel.

> > Compare for example the usage in linux-nat.c:
> >
> > /* Create a prototype generic GNU/Linux target.
>
> That's a mistake, IMO. There's no need for GNU here.

This is common usage throughout the Linux target and native files.
Even looking just at the very first lines of those files:

[uweigand@blc4eb184639574 gdb]$ head -1 *-linux-tdep.c | grep Linux
/* Target-dependent code for GNU/Linux on Alpha.
/* Target-dependent code for GNU/Linux x86-64.
/* GNU/Linux on ARM target support.
/* Target-dependent code for GNU/Linux running on the Fujitsu FR-V,
/* Target-dependent code for GNU/Linux running on PA-RISC, for GDB.
/* Target-dependent code for GNU/Linux i386.
/* Target-dependent code for GNU/Linux m32r.
/* Target-dependent code for GNU/Linux on MIPS processors.
/* Target-dependent code for GNU/Linux Super-H.
/* Target-dependent code for GNU/Linux UltraSPARC.
/* Target-dependent code for GNU/Linux SPARC.
/* Target-dependent code for GNU/Linux on Xtensa processors.
[uweigand@blc4eb184639574 gdb]$ head -1 *-linux-nat.c | grep Linux
/* Low level Alpha GNU/Linux interface, for GDB when running native.
/* Native-dependent code for GNU/Linux x86-64.
/* GNU/Linux on ARM native support.
/* Functions specific to running GDB native on HPPA running GNU/Linux.
/* Native-dependent code for GNU/Linux i386.
/* Native-dependent code for GNU/Linux m32r.
/* Native-dependent code for GNU/Linux on MIPS processors.
/* PPC GNU/Linux native support.
/* Native-dependent code for GNU/Linux UltraSPARC.
/* Native-dependent code for GNU/Linux SPARC.
/* Xtensa GNU/Linux native support.

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com