Re: RFA: Try to include libunwind-ia64.h in libunwind-frame.h

Pedro Alves
2012-02-13T19:20:25Z

On 02/13/2012 07:02 PM, Jan Kratochvil wrote:
> On Mon, 13 Feb 2012 19:57:27 +0100, Pedro Alves wrote:
>> I don't understand why we ever include "libunwind.h" though.
>
>> libunwind is only ever used by ia64 currently.
>
> It is required for ia64 but it can be used even with non-ia64 archs.

How? AFAICS, no other target installs the libunwind sniffer. It's just
dead code on other archs, if I'm reading the code correctly.

> I do not have it tested, though. I will test it before a check-in.
>
>
>> If some other target wanting to use libunwind shows up, then we'll need to
>> include libunwind-fooarch.h instead
>
> For native configuration libunwind.h includes the right libunwind-fooarch.h
> for us.
> /usr/include/libunwind.h
> #if defined __arm__
> # include "libunwind-arm.h"
> #elif defined __hppa__
> # include "libunwind-hppa.h"
> [...]
>
> The cross-build does not work for ia64 well this way, though. So libunwind
> for non-ia64 works even in the non-cross mode. This is the part I did not
> want to start implementing as it may get all more complex.

Sure. We don't make sure to include (literaly) "libunwind.h" only when
native, so it's conceptually wrong to include it in target dependent files.

>
>> IOW, "libunwind.h" will always be conceptually wrong for gdb.
>
> libunwind has pretty active development, I can imaging libunwind developers
> / enthusiasts would like to use it for GDB on x86*.

I did not say libunwind the library itself is conceptually wrong. :-) I'm talking
about including the literal "libunwind.h" header. Including the literal
"libunwind.h" file directly will always be conceptually wrong for gdb, because
that includes the libunwind header for the host gdb is running on. The right
conceptual model for gdb is to always treat libunwind as remote/cross, and
thus always include the arch specific libunwind-foo.h header.

--
Pedro Alves