|
The first step to debug a program is to run the debugger ! There's two ways of starting Bugloo. You can either invoke Bugloo with the program you want to debug (hereafter the debuggee), or you can set it later once that the debugger has been started.
Suppose you want to debug a program named stack. Let's say that you want to pass arguments foo bar gee in parameter to this program. You can do it by typing the following line into a shell:
This will start Bugloo, and after a short time you sould see its Logo displayed on the screen:
The second way of starting the debuggee you want is to specify it to Bugloo after it has been loaded. You can set the debuggee and/or its arguments at anytime by using the (debuggee) command:
Set the new debuggee and its arguments.
With the preceding example, you can type:
Bugloo will set the new debuggee and will indicate it to you:
Note that at anytime you can ask Bugloo some informations about the current debuggee and its arguments.
Get informations about the current debuggee With the preceding example, you can type the following command to verify that the debuggee is correct.
Once that you set the debuggee, you must run it. None of the preceding command run the debuggee, they only inform Bugloo about what program to start. The process of running the debuggee is done by:
2.2.1 Creating a debuggee VM
Run the debuggee program
Reset the state of the debugger and run the debuggee
You typically load the debuggee in memory by using the (run) commands. This will start a new VM where the debuggee will reside in. The two preceding commands differ only when the debuggee hast terminated, and that you want to start a new execution without exiting the debugger. The first one preserve the current state of the debugger (i.e. breakpoint that are still alive, current filters etc... will be effective in the next execution), while the second one really reset the state of the debugger. For example, if you use the (run) With the program stack, you will get the following result:
Note that you can change original arguments passed to the main function of the program by setting optional arguments of these two commands. 2.2.2 Starting the debuggeeWhen a debuggee is loaded in memory via the (run) command, it is always started in a suspended mode. This means that the program will not start its execution until you use the (resume) command. See chapter Execution control for a complete description of this command.For example, as soon as you type type (resume) into the console, the execution of the program stack should start and terminate by printing something on the screen:
Note that when you start Bugloo, or when you set a new debuggee, it is not necessary to type the (run) command. If you use (resume) whereas the debuggee hasn't been loaded in memory yet, Bugloo will automatically load it for you. |