85 signals 429 figure 827 shows a program that catches

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The startup code sets up the stack and passes control to the main routine of the new program, which has a prototype of the form int main(int argc, char **argv, char **envp); or equivalently 416 envp envp envp[0] envp[1] ... envp[n-1] NULL CHAPTER 8. EXCEPTIONAL CONTROL FLOW "PWD=/usr/droh" "PRINTER=iron" "USER=droh" Figure 8.18: Organization of an environment variable list. int main(int argc, char *argv, char *envp); When main begins executing on a Linux system, the user stack has the organization shown in Figure 8.19. Let’s work our way from the bottom of the stack (the highest address) to the top (the lowest address). First 0xbfffffff null-terminated environment variable strings null-terminated command-line arg strings (unused) envp[n] == NULL envp[n-1] bottom of stack ... envp[0] argv[argc] = NULL argv[argc-1] environ ... argv[0] (dynamic linker variables) envp argv argc 0xbffffa7c stack frame for main top of stack Figure 8.19: Typical organization of the user stack when a ne...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online