This is the mail archive of the gdb@sources.redhat.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]
Other format: [Raw text]

MIPS stack tracing



On Thu, Jan 31, 2002 at 05:27:30PM -0500, Don Bowman wrote:
...
> The problem is that the compiler emits multiple returns
> per function. The algorithm gdb follows is that specified
> by the SYSV ABI (which the compiler is breaking). I looked

The only SYSV ABI document on MIPS that I am aware of is the
MIPS Processor Supplement.  That document applies to what SGI
calls -32 or o32, the old-32bit ABI.
The section "Standard Called Function Rules" in that document
gives the rule, page 3-18 in my copy.

I am *presuming* that is what you refer to here.
If not, then... the following is 'incomplete'.

Modern gcc (for modern MIPS targets) emits code in
what SGI calls the n32 or 64 ABIs
(or variations thereof, for other MIPS users), 
and those ABIs are not defined by the SYSV ABI Mips Processor Supplement!  
For these other ABIs, multiple returns per function are allowed and normal.
For non-SGI ABIs the rules are, well, whatever they are.  
MIPS is  the best source
of info, and "See MIPS Run" by Sweetman has been mentioned by
others here as a good book on MIPS (I concur).
The SGI n32 ABI document is available
for anyone that wishes to see it.
	http://techpubs.sgi.com
specifically:
  http://techpubs.sgi.com/library/tpl/cgi-bin/browse.cgi?
  coll=0650&db=bks&cmd=toc&pth=/SGI_Developer/Mpro_n32_ABI
(I broke that long URL by hand: rejoin it for the URL to work)

Aside: in spite of the ABI rule, the MIPS compilers for the old-32bit
  ABI case when -O3 was used always could generate multiple
  returns for a function and did at times!! (but -O3 was
  relatively rarely used for old-32bit ABI compiles)

For SGI the n32 and 64 ABIs are defined by other SGI documents
(such as the n32 book)
and for other folks using MIPS processors they are defined by
MIPS or whoever 'controls' (whatever that means) the particular
target ABI.

In short, you've been mislead by a document which no longer
applies.  gcc is not violating any rule I know of by generating
multiple returns per function.


Corrections welcome.
David Anderson davea@sgi.com


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