This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFA: AIX 64-bit mega-patch


On Wed, Jun 14, 2000 at 11:03:15AM +1000, Andrew Cagney wrote:
> 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

Or possibly download code and execute it to determine what the ABI is at
runtime, based on various features and bugs.  The Pentium-III manual (and the
Intel web site) give code of how to identify all of the Intel varients
(strangely, they omit any reference to the AMD chips).  Also the Linux kernel
should have the appropriate identification code (and hey, it is already GPL'ed
:-)

-- 
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]