RFA: AIX 64-bit mega-patch

Andrew Cagney ac131313@cygnus.com
Tue Jun 13 18:04:00 GMT 2000

Nick Duffek wrote:

> Suppose GDB running natively on an i386 is asked to debug a binary that
> contains Pentium Pro instructions.  Before starting an inferior process,
> it might be reasonable for the disassemble command to decode those Pentium
> Pro instructions, i.e. for GDB to set its architecture to match the
> binary.
> However, when running an inferior i386 process, it's arguably more
> reasonable for GDB's disassembly to identify those Pentium Pro
> instructions as illegal, since the i386 process being debugged will see
> them that way.  As a result, when the i386 process gets a SIGILL and the
> user types "disas $pc", it'll be obvious where the problem lies.  This
> is accomplished by GDB setting its architecture to match the process.

Hmm, thats an interesting one. Not thought of it.
An immediate technical problem is that GDB doesn't know how to ask the
target what the current ISA/ABI is.

I can think of several possible behavours:

	o	if the user entered ``set arch''
		then well, the user is always right
		(this is the easy one)

	o	if the user hasn't entered ``set arch''
		(ie ``set arch auto'') then:

		o	silently stick with the object file

		o	silently switch

		o	verbose versions of the above

There is the call bfd_arch_get_compatible() but (sigh) that, yet again,
expects BFDs as arguments => more BFD interface tweeks :-/

> I can imagine a more radical example where two slightly-different CPUs
> interpret the same instruction as valid but different, but I don't know
> whether such CPU pairs exist.

Have a look at the MIPS (sim/mips/*.igen) ...

> Anyway, in my previous message, I was arguing in favor of GDB initializing
> its architecture to match processes rather than binaries, and it sounds
> like that's already the policy.
> Similarly, if a core file is present, I would argue that GDB should
> initialize its architecture from the process represented by the core file
> rather than from the binary.

Yes, MichaelS fixed that one.  It takes the architecture from the core
unless forced to do otherwize.

> Is this all hashed out in a document somewhere?  Maybe I'm wasting time by
> working through already-resolved issues.

The details of the interaction are not hashed out.  So no you're not
wasting time!


More information about the Gdb-patches mailing list