O'Reilly logo

Panic! UNIX® System Crash Dump Analysis by Kimberley Brown, Chris Drake

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Stack Tracebacks

We’ve spent enough time talking about stacks. Now let’s see the theory put to actual use. We will start by using the little C program below, which we will run under adb.

Example 18-1. little.c

main () 
{
  fred (1, 2, 3); 
} 

int fred (a, b, c) 
int a, b, c; 
{} 

In little.c, shown above, the main() routine calls the fred() routine, passing it three integer values. The fred() routine does nothing except return to the main() routine.

Using adb, let’s first look at the SPARC assembly instructions for main().

Example 18-1. Viewing little’s main routine via adb

Hiya...  cc -o little little.c 
Hiya...  adb little -
main,20?ai main: main: save %sp, -0x60, %sp main+4: mov 0x1, %l0 main+8: mov 0x2, %l1 main+0xc: mov 0x3, %l2 main+0x10: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required