Compile the following .cpp file using -g option
include appropriate include files. ( i have skipped them here ...)
Code:
void
main()
{
for (int i=0; 1; i++)
{
cout << "i = " << i << endl ;
sleep (10) ;
}
return ;
}
After compilation the binary name is "db"
I run the db and get the PID of it. Its PID is 60622
Code:
$dbx -a 60622
Waiting to attach to process 60622 ...
Successfully attached to db.
Type 'help' for help.
reading symbolic information ...
stopped in _p_nsleep at 0xd0013b54 ($t1)
0xd0013b54 (_p_nsleep+0x10) 80410014 lwz r2,0x14(r1)
(dbx) where
_p_nsleep(??, ??) at 0xd0013b54
raise.nsleep(??, ??) at 0xd018776c
sleep(??) at 0xd01e2578
main(), line 22 in "db.cpp"
(dbx) print i
4
(dbx) printf("hello world")
printf("hello world")
^ unrecognized command
(dbx) print ("hello world");
hello world
(dbx) file
db.cpp
(dbx) ?i
no match
(dbx) /i
1 #include <iostream.h>
(dbx) next
stopped in main at line 19 in file "db.cpp" ($t1)
19 for (int i=0; 1; i++)
(dbx) next
stopped in main at line 21 in file "db.cpp" ($t1)
21 cout << "i = " << i << endl ;
(dbx) next
stopped in main at line 22 in file "db.cpp" ($t1)
22 sleep (10) ;
(dbx) next
stopped in main at line 19 in file "db.cpp" ($t1)
19 for (int i=0; 1; i++)
(dbx) print i
5
(dbx) help
Commands:
alias assign attribute call case catch
clear cleari condition cont delete detach
display(/) down dump edit file func
goto gotoi help ignore list listi
map move multproc mutex next nexti
print prompt quit registers rerun return
run rwlock screen search(/?) set sh
skip source status step stepi stop
stopi thread trace tracei unalias unset
up use whatis where whereis which
Topics:
startup execution breakpoints files data
machine environment threads expressions scope
set_variables usage
Type "help <command>" or "help <topic>" for help on a command or topic.
(dbx) quit
This gives you some idea how to start debugging ...
This is same in most of the unix debuggers ... ;
For more infomration on dbx,
check the following URL:
I just started a new semester and I started my UNIX class yesterday. I've already decided to use python along with my learning process but what I really want to use with it is Kali as my UNIX/Linux platform to learn off of since I already wanted to learn Cyber Sec. anyways. I just wanted to know if... (12 Replies)
GNU insight debugger is not available now a days and it is required to debug/inspect
assembly code as written in the book Assembly Language Programming step by step in Linux so my question is; is there any alternative to insight that I can use instead of insight in which I can get the same... (5 Replies)
I'm wanting to use a symbolic debugger to find a problem with a C program I'm working on in the HP-UX engine B.10.20 E 9000/800 environment; I've used the GNU debugger on Linux, but it does not exist on UNIX. A fellow here mentioned DDE, Distributed Debugging Environment, but I don't seem to be... (3 Replies)
hello
i'm working on cobol with unix
just want to know if there is any command in unix that related to debugger
i've been told something like anim command
i try to search for man anim
result :ERROR: Manual entry does not exist for page anim
does anyone have an answer ?
another thing ... (1 Reply)
Can any body gime a link for sample programs which can help me to debug the C programs using unix gdb debuger. Please send me the sample programs wch can explain debugging also. I am a begginer for GDB.
KG (1 Reply)
Hi all,
is it possible to skip a function with the wdb debugger ?
could be helpful instead of compiling the whole bunch again
does someone know how to do this ?
thx
Sven (4 Replies)