Strace -p PID
note it should not run more as it eats lot of resources .
$ gdb --quiet
(gdb) attach pid
(gdb) info proc
process 13601
cmdline = './a.out'
cwd = '/home/amit/ccode'
exe = '/home/amit/ccode/a.out'
(gdb) info functions
---Fir this command in compilation -g flag is mandatory in gcc to insert debug information
(gdb) list main
22 printf("done thread #%ld!\n", tid);
23 pthread_exit(NULL);
24 }
25
26 int main (int argc, char *argv[])
27 {
28 pthread_t threads[NUM_THREADS];
29 int rc;
30 long t;
--------Show Assembler code disass option of gdb------
(gdb) disass main
Dump of assembler code for function main:
0x0804858f : push %ebp
0x08048590 : mov %esp,%ebp
0x08048592 : sub $0x28,%esp
$gdb -p pid
Ref : http://www.ibm.com/developerworks/aix/library/au-unix-strace.html