Off-Topic > Off-Topic - Tiny Core Lounge

Small C Program

<< < (2/2)

nomer:
Oh, I didn't consider that possibility. Thanks for pointing that out.

curaga:
Welcome to the low-level land ;)

Rich:
Hi nomer
If you install   gdb.tcz   you will be able step through a program, examine/change variables, and set breakpoints.
Open a terminal and stretch it to twice its normal size, then:
1. Compile your program using the   -O0 -g   options, do not strip the program.
2. gdb -tui YourProgram
3. br main                (Sets a breakpoint at main)
4. r                             (Short for run)
The top half of the window displays your source code. The next line to be executed is highlighted. Here is a good
tutorial on the basics:
http://beej.us/guide/bggdb/
I've found gdb to be handy when a program does exactly what I told it to do, instead of what I wanted it to do.

Rich:
Hi nomer
Since you are doing screen I/O, read the section called   Separating the Input/Output    in this link:
http://dirac.org/linux/gdb/07-Debugging_Ncurses_Programs.php
This will keep the debugger screen from getting messed up by the printf statement.

Navigation

[0] Message Index

[*] Previous page

Go to full version