Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A book I am reading refers to an include file that shows how a stack frame looks on one's UNIX system.

In particular: /usr/include/sys/frame.h

I am having trouble finding the modern equivalent. Anyone have an idea? I'm on Ubuntu 12.10.


By the way, it is a description of stack frames and activation records that I want--not necesssarily that relic of a file. That information was stored in that file, "back in the day", though.

share|improve this question
    
Maybe arch/x86/include/asm/frame.h in your kernel headers directory? (assuming you're on an x86 system, of course.) –  user55325 Mar 7 '13 at 7:04
    
Now that I look at it, and keeping in mind that I'm not really familiar with this low-level kernel kind of thing, sigframe.h in the same directory looks more likely... hopefully someone with some expertise will come up with a real answer though. –  user55325 Mar 7 '13 at 7:13
    
@user55325 your first suggestion is definitely a good lead, just took a look at it. However, I'm not fully convinced it is what my author had in mind... let's see what others have to say! –  d0rmLife Mar 7 '13 at 18:56

1 Answer 1

up vote 2 down vote accepted

You might want to have a look at the ptrace.h and calling.h files, which have some C-structures defining the stack frame layout and calling conventions (they can be found in the same folders as frame.h). Furthermore, the elfcore.h header file included with the gperftools project may provide some useful insight into the call-stack frames.

Also if you're so inclined, you might want to look at the x86 Assembly and x86 Disassembly books on Wikibooks. They have quite a lot of useful information (both high and low level) regarding stack frames and calling convention details.


In terms of frame.h, calling sudo find / -name "frame.h" on my Xubuntu 12.04 install returns the following:

/usr/src/linux-headers-3.2.0-23/arch/x86/include/asm/frame.h
/usr/src/linux-headers-3.2.0-33/arch/x86/include/asm/frame.h
/usr/src/linux-headers-3.2.0-35/arch/x86/include/asm/frame.h
/usr/src/linux-headers-3.2.0-34/arch/x86/include/asm/frame.h

Not surprisingly, there is no change to the file between the kernel versions listed above, and it's unlikely you would see any changes for compatibility reasons (of course, this depends on what architecture your system is).

share|improve this answer
    
Yes, I have looked at that file. I have my doubts it is what the original author referred to. I was wondering if anyone familiar with legacy systems would be able to comment. –  d0rmLife Mar 7 '13 at 19:54
    
+1 for elfcore.h header file. That is more like it...! :) Reading through it now. –  d0rmLife Mar 7 '13 at 19:59
    
@d0rmLife updated the answer, you might also want to have a look at the ptrace.h file which can be found in your kernel header file directory as well. –  Breakthrough Mar 7 '13 at 20:01
    
Great find, that definitely contains the sort of information I was looking for. –  d0rmLife Mar 7 '13 at 20:05
1  
@d0rmLife a bit of both. I started looking for where some of the C macros were defined, and which files those header files included (and so on and so fourth). I also know calling conventions are closely related with stack frames, so I thought that header might also be of some service. Also if you're inclined, you might want to look at the x86 Assembly and x86 Disassembly books on Wikibooks, they have quite a lot of useful information. –  Breakthrough Mar 7 '13 at 20:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.