Go to the first, previous, next, last section, table of contents.


GDB.h: sending plain gdb commands to the debugger

`GDB.h' provides macros for generating user specified commands in the output of the `nana' command. They are not included by default in the `nana.h' file.

Macro: void GDB (command)
Emit a single line command when running this file through `nana'. Note that each line must be passed off separately to the `GDB' macro.

This could be used to set debugger options or to define procedures inside `gdb', e.g.

  GDB(define checkstack);
  GDB(  if 0 <= n && n <= 10);
  GDB(    print "stack ok");
  GDB(  else);
  GDB(    print "stack corrupted");
  GDB(  end);
  GDB(end);

Macro: void GDBCALL (command)
Causes a single gdb command to be executed whenever control passes through this line of code. After the users command is executed control automatically returns to the program.

  GDBCALL(set memory_check = 1)

These macros could used for instrumenting code or setting up test harnesses, e.g.


GDB(set $siocall = 0);
GDB(set $sioerr = 0);

void sio_driver() {
  GDBCALL(set $siocall++)
  if(SIO_REQ & 0x010) {
    GDBCALL(set $sioerr++); 
    ...
  }
}


Go to the first, previous, next, last section, table of contents.