tags:

views:

108

answers:

2

hi i'm pretty much using gdb for the first time, i tried looking at the internet for info about my prob but i could not find.

i run

$gdb

then i'm running

attach <mypid>

then i see that my process is stuck (which is probably ok) now i want it to continue running so i run

continue

and my process continues running but from here i'm stuck if i want again to watch my current stack trace etc how do i do that i couldnt get out of continuing... i tried 'ctrl-d' etc nothing worked for me... (was just a guess).

thanks...

A: 

Control+C in the gdb process should bring you back to the command prompt.

Tyler McHenry
ctrl-c does not work for me have a look please:'bash-3.00# gdbGNU gdb 6.8Copyright (C) 2008 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "i386-pc-solaris2.10".(gdb) attach 4305Attaching to process 4305Retry #1:Retry #2:'
Jason
<pre>Retry #3:Retry #4:[New LWP 1]0xfef298b5 in ?? ()(gdb) info frameStack level 0, frame at 0x80477c8: eip = 0xfef298b5; saved eip 0xfef1b5d2 Arglist at 0x80477c0, args: Locals at 0x80477c0, Previous frame's sp is 0x80477c8 Saved registers: eip at 0x80477c4(gdb) printThe history is empty.(gdb) continueContinuing.^D^Cquit^C^C^C^C</pre>
Jason
how can i format this plz? i had this in separate lines how do i have it also in comments what i pasted in separate lines please?
Jason
You can't format (much) in comments. Edit it into your question.
Tyler McHenry
A: 

Here's a short GDB tutorial, and here's a full GDB manual.

The point of debugging is to inspect interesting/suspicious parts of the program. Breakpoints allow you to stop execution at some source location, and watchpoints allow you to stop when interesting data changes.

Simple examples:

(gdb) break my_function
(gdb) cont

This will insert a breakpoint at the beginning of my_function, so when execution of the program enters the function the program will be suspended and you get GDB prompt back, and be able to inspect program's state. Or you can step through the code.

(gdb) watch my_var
(gdb) cont

Same, but not the program will be stopped at whatever location that modifies the value of my_var.

Shameless plug - here's a link to my GDB presentation at NYC BSD User Group. Hope this helps.

Nikolai N Fetissov
but i just wanted to pick a point in time of my own and at that point to examine the stack trace... and afterwards to continue the program, i didn't want breakpoints... in my case I want to examine the stack trace of the program at a time of my own.
Jason
OK, what does `info signal` says about `SIGINT`?
Nikolai N Fetissov