Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Jdb_module Class Reference

Base class for any kernel debugger module. More...

#include <jdb_module.h>

Inheritance diagram for Jdb_module:

Go_m Help_m Io_m Jdb_attach_irq Jdb_bt Jdb_cb Jdb_counters Jdb_disasm Jdb_dump Jdb_exit_module Jdb_halt_thread Jdb_iomap Jdb_kern_info Jdb_list_threads Jdb_list_timeouts Jdb_mapdb Jdb_misc_debug Jdb_misc_general Jdb_misc_info Jdb_misc_monitor Jdb_pcm Jdb_ptab_m Jdb_set_bp Jdb_set_trace Jdb_tbuf_show Jdb_tcb List of all members.

Public Types

typedef void( Gotkey )(char *&str, int maxlen, int c)
enum  Action_code {
  NOTHING = 0, LEAVE, GO_BACK, ERROR,
  EXTRA_INPUT, EXTRA_INPUT_WITH_NEXTCHAR
}
 Possible return codes from action(). More...

Public Member Functions

 Jdb_module (char const *category="MISC") FIASCO_INIT
 Create a new instance of an Jdb_module.
virtual ~Jdb_module ()
 dtor
virtual Action_code action (int cmd, void *&args, char const *&fmt, int &next_char)=0
 The actual handler of the module.
virtual int const num_cmds () const =0
 The number of commands this modules provides.
virtual Cmd const *const cmds () const =0
 The commands this module provides.
Jdb_category const * category () const
 Get the category of this module.
Jdb_modulenext () const
 Get the next registered Jdb_module.
Cmd const * has_cmd (char const *cmd, bool short_mode=false) const
 Get Cmd structure according to cmd.

Static Public Member Functions

static Jdb_modulefirst ()
 Get the first registered Jdb_module.

Private Attributes

Jdb_module_next
Jdb_module_prev
Jdb_category const *const _cat

Static Private Attributes

static Jdb_module_first = 0

Classes

struct  Cmd
 A Jdb command description. More...

Detailed Description

Base class for any kernel debugger module.

This class is the base for any module of the modularized Jdb. Ths idea is that Jdb can be extended by plugging in a new module, which provides one ore more commands and their implementations to Jdb.

A new module can be created by deriving from Jdb_module and providing the neccessary methods (num_cmds, cmds, action, and maybe the constructor). To plug the module into Jdb a static instance of the module must be created, with "INIT_PRIORITY(JDB_MODULE_INIT_PRIO)".


Member Typedef Documentation

typedef void( Jdb_module::Gotkey)(char *&str, int maxlen, int c)
 


Member Enumeration Documentation

enum Jdb_module::Action_code
 

Possible return codes from action().

The actual handler of the Jdb_module (action()) may return any value of this type.

Enumeration values:
NOTHING  Do nothing, wait for the next command.
LEAVE  Leave the kernel debugger.
GO_BACK  got KEY_HOME
ERROR  there was an error (abort or invalid input)
EXTRA_INPUT  Wait for new input arguments.

See also:
action() for detailed information.
EXTRA_INPUT_WITH_NEXTCHAR  Wait for new input arguments and interpret character in next_char as next keystroke.

See also:
action() for detailed information.


Constructor & Destructor Documentation

Jdb_module::Jdb_module char const *  category = "MISC"  ) 
 

Create a new instance of an Jdb_module.

Parameters:
category the name of the category the module fits in. This category must exist (see Jdb_category) or the module is added to the "MISC" category.
This constructor automatically registers the module at the Jdb_core. The derived modules must provide an own constructor if another category than "MISC" should be used.

See also:
Jdb_core

Jdb_category

Jdb_module::~Jdb_module  )  [virtual]
 

dtor


Member Function Documentation

virtual Action_code Jdb_module::action int  cmd,
void *&  args,
char const *&  fmt,
int &  next_char
[pure virtual]
 

The actual handler of the module.

Parameters:
cmd the command ID (see Cmd::id) of the executed command.
args a reference to the argument buffer pointer.
fmt a reference to the format string pointer.
This method is pure virtual and must be provided by the specific derivate of the Jdb_module. action() is called if one of the module's commands was issued and the input according to the format string is read.

The args and fmt arguments are references because they may be modified by the action() method and extra input may be requested by returning Action_code::EXTRA_INPUT. In the case where Action_code::EXTRA_INPUT is returned the Jdb_core reads again the values according to the given format (fmt) and enters action(). With this mechanism it is possible to request further input depending on the already given input.

Implemented in Jdb_attach_irq, Jdb_set_bp, Jdb_bt, Jdb_cb, Go_m, Help_m, Jdb_counters, Jdb_disasm, Jdb_dump, Jdb_exit_module, Jdb_halt_thread, Io_m, Jdb_iomap, Jdb_kern_info, Jdb_mapdb, Jdb_misc_general, Jdb_misc_debug, Jdb_misc_info, Jdb_misc_monitor, Jdb_pcm, Jdb_ptab_m, Jdb_tbuf_show, Jdb_tcb, Jdb_list_threads, Jdb_list_timeouts, and Jdb_set_trace.

Jdb_category const * Jdb_module::category  )  const [inline]
 

Get the category of this module.

virtual Cmd const* const Jdb_module::cmds  )  const [pure virtual]
 

The commands this module provides.

An array of Cmd structures must be returned, where each entry describes a single command. The command IDs (see Cmd::id) should be unique within the module, so that action() can distinguish between the different commands.

See also:
num_cmds()

Cmd

action()

Implemented in Jdb_attach_irq, Jdb_set_bp, Jdb_bt, Jdb_cb, Go_m, Help_m, Jdb_counters, Jdb_disasm, Jdb_dump, Jdb_exit_module, Jdb_halt_thread, Io_m, Jdb_iomap, Jdb_kern_info, Jdb_mapdb, Jdb_misc_general, Jdb_misc_debug, Jdb_misc_info, Jdb_misc_monitor, Jdb_pcm, Jdb_ptab_m, Jdb_tbuf_show, Jdb_tcb, Jdb_list_threads, Jdb_list_timeouts, and Jdb_set_trace.

Jdb_module * Jdb_module::first  )  [inline, static]
 

Get the first registered Jdb_module.

Jdb_module::Cmd const * Jdb_module::has_cmd char const *  cmd,
bool  short_mode = false
const
 

Get Cmd structure according to cmd.

Parameters:
cmd the command you are looking for.
short_mode if true the short commands are looked up (see Cmd::scmd).
Returns:
A pointer to the Cmd structure if the command is found, or a null pointer otherwise.

Jdb_module * Jdb_module::next  )  const [inline]
 

Get the next registered Jdb_module.

virtual int const Jdb_module::num_cmds  )  const [pure virtual]
 

The number of commands this modules provides.

This method must return how many Cmd structures can be found in the array returned by cmds().

See also:
cmds()

Implemented in Jdb_attach_irq, Jdb_set_bp, Jdb_bt, Jdb_cb, Go_m, Help_m, Jdb_counters, Jdb_disasm, Jdb_dump, Jdb_exit_module, Jdb_halt_thread, Io_m, Jdb_iomap, Jdb_kern_info, Jdb_mapdb, Jdb_misc_general, Jdb_misc_debug, Jdb_misc_info, Jdb_misc_monitor, Jdb_pcm, Jdb_ptab_m, Jdb_tbuf_show, Jdb_tcb, Jdb_list_threads, Jdb_list_timeouts, and Jdb_set_trace.


Member Data Documentation

Jdb_category const* const Jdb_module::_cat [private]
 

Jdb_module * Jdb_module::_first = 0 [static, private]
 

Reimplemented in Jdb_kern_info.

Jdb_module* Jdb_module::_next [private]
 

Jdb_module* Jdb_module::_prev [private]
 


The documentation for this class was generated from the following files:
Generated on Mon Sep 26 14:20:15 2005 for Fiasco by  doxygen 1.4.2