Nemiver  0.3
Public Types | Public Member Functions | List of all members
nemiver::GDBMIParser Class Reference

#include <nmv-gdbmi-parser.h>

Public Types

enum  Mode { UNDEFINED_MODE =0, STRICT_MODE, BROKEN_MODE }
 Parsing mode. More...
 

Public Member Functions

 GDBMIParser (Mode a_mode=STRICT_MODE)
 
 GDBMIParser (const UString &a_input, Mode a_mode=STRICT_MODE)
 
virtual ~GDBMIParser ()
 
void push_input (const UString &a_input)
 
void pop_input ()
 
const UStringget_input () const
 
void set_mode (Mode)
 
Mode get_mode () const
 
bool parse_string (UString::size_type a_from, UString::size_type &a_to, UString &a_string)
 
bool parse_octal_escape (UString::size_type a_from, UString::size_type &a_to, unsigned char &a_byte_value)
 
bool parse_octal_escape_sequence (UString::size_type a_from, UString::size_type &a_to, UString &a_result)
 
bool parse_c_string_body (UString::size_type a_from, UString::size_type &a_to, UString &a_string)
 
bool parse_c_string (UString::size_type a_from, UString::size_type &a_to, UString &a_c_string)
 
bool parse_embedded_c_string_body (UString::size_type a_from, UString::size_type &a_to, UString &a_string)
 
bool parse_embedded_c_string (UString::size_type a_from, UString::size_type &a_to, UString &a_string)
 
bool parse_gdbmi_result (UString::size_type a_from, UString::size_type &a_to, GDBMIResultSafePtr &a_value)
 
bool parse_gdbmi_value (UString::size_type a_from, UString::size_type &a_to, GDBMIValueSafePtr &a_value)
 parse a GDB/MI value. GDB/MI value type is defined as: VALUE ==> CONST | TUPLE | LIST CONSTis a string, basically. Look at parse_string() for more. TUPLE is a GDB/MI tuple. Look at parse_tuple() for more. LIST is a GDB/MI list. It is either a list of GDB/MI Result or a list of GDB/MI value. Yeah, that can be recursive ... To parse a GDB/MI list, we use parse_list() defined above. You can look at the GDB/MI output syntax for more. More...
 
bool parse_gdbmi_tuple (UString::size_type a_from, UString::size_type &a_to, GDBMITupleSafePtr &a_tuple)
 
bool parse_gdbmi_list (UString::size_type a_from, UString::size_type &a_to, GDBMIListSafePtr &a_list)
 
bool parse_gdbmi_string_result (UString::size_type a_from, UString::size_type &a_to, UString &a_variable, UString &a_value)
 
bool parse_stream_record (UString::size_type a_from, UString::size_type &a_to, Output::StreamRecord &a_record)
 
bool parse_stopped_async_output (UString::size_type a_from, UString::size_type &a_to, bool &a_got_frame, IDebugger::Frame &a_frame, map< UString, UString > &a_attrs)
 
bool parse_running_async_output (UString::size_type a_from, UString::size_type &a_to, int &a_thread_id)
 
bool parse_thread_selected_async_output (UString::size_type a_from, UString::size_type &a_to, int &a_thread_id)
 
bool parse_attribute (UString::size_type a_from, UString::size_type &a_to, UString &a_name, UString &a_value)
 
bool parse_attribute (UString::size_type a_from, UString::size_type &a_to, UString &a_name, GDBMIResultSafePtr &a_value)
 
bool parse_attributes (UString::size_type a_from, UString::size_type &a_to, map< UString, UString > &a_attrs)
 parses an attribute list More...
 
bool parse_frame (UString::size_type a_from, UString::size_type &a_to, IDebugger::Frame &a_frame)
 parses a function frame More...
 
bool parse_out_of_band_record (UString::size_type a_from, UString::size_type &a_to, Output::OutOfBandRecord &a_record)
 
bool parse_breakpoint_with_one_loc (Glib::ustring::size_type a_from, Glib::ustring::size_type &a_to, bool is_sub_breakpoint, IDebugger::Breakpoint &a_bkpt)
 
bool parse_breakpoint (Glib::ustring::size_type a_from, Glib::ustring::size_type &a_to, IDebugger::Breakpoint &a_bkpt)
 parses a breakpoint definition as returned by gdb. More...
 
bool parse_breakpoint_table (UString::size_type a_from, UString::size_type &a_to, map< string, IDebugger::Breakpoint > &a_breakpoints)
 
bool parse_breakpoint_modified_async_output (UString::size_type a_from, UString::size_type &a_to, IDebugger::Breakpoint &a_b)
 
bool parse_threads_list (UString::size_type a_from, UString::size_type &a_to, std::list< int > &a_thread_ids)
 
bool parse_new_thread_id (UString::size_type a_from, UString::size_type &a_to, int &a_thread_id, IDebugger::Frame &a_frame)
 
bool parse_file_list (UString::size_type a_from, UString::size_type &a_to, std::vector< UString > &a_files)
 
bool parse_call_stack (const UString::size_type a_from, UString::size_type &a_to, vector< IDebugger::Frame > &a_stack)
 
bool parse_stack_arguments (UString::size_type a_from, UString::size_type &a_to, map< int, list< IDebugger::VariableSafePtr > > &a_params)
 
bool parse_local_var_list (UString::size_type a_from, UString::size_type &a_to, list< IDebugger::VariableSafePtr > &a_vars)
 
bool parse_member_variable (const UString::size_type a_from, UString::size_type &a_to, IDebugger::VariableSafePtr &a_var, bool a_in_unnamed_var=false)
 
bool parse_variable_value (const UString::size_type a_from, UString::size_type &a_to, IDebugger::VariableSafePtr &a_var)
 
bool parse_overloads_choice_prompt (UString::size_type a_from, UString::size_type &a_to, vector< IDebugger::OverloadsChoiceEntry > &a_prompts)
 
bool parse_register_names (UString::size_type a_from, UString::size_type &a_to, std::map< IDebugger::register_id_t, UString > &a_registers)
 
bool parse_changed_registers (UString::size_type a_from, UString::size_type &a_to, std::list< IDebugger::register_id_t > &a_regs)
 
bool parse_register_values (UString::size_type a_from, UString::size_type &a_to, std::map< IDebugger::register_id_t, UString > &a_values)
 
bool parse_memory_values (UString::size_type a_from, UString::size_type &a_to, size_t &a_start_addr, std::vector< uint8_t > &a_values)
 
bool parse_asm_instruction_list (UString::size_type a_from, UString::size_type &a_to, std::list< common::Asm > &a_asm)
 
bool parse_variable (UString::size_type a_from, UString::size_type &a_to, IDebugger::VariableSafePtr &a_var)
 
bool parse_variables_deleted (UString::size_type a_from, UString::size_type &a_to, unsigned int &a_nb_vars_deleted)
 
bool parse_var_list_children (UString::size_type a_from, UString::size_type &a_to, vector< IDebugger::VariableSafePtr > &a_vars)
 
bool parse_var_changed_list (UString::size_type a_from, UString::size_type &a_to, list< VarChangePtr > &a_var_changes)
 
bool parse_var_path_expression (UString::size_type a_from, UString::size_type &a_to, UString &a_expression)
 
bool parse_variable_format (UString::size_type a_from, UString::size_type &a_to, IDebugger::Variable::Format &a_format, UString &a_value)
 
bool parse_result_record (UString::size_type a_from, UString::size_type &a_to, Output::ResultRecord &a_record)
 
bool parse_output_record (UString::size_type a_from, UString::size_type &a_to, Output &a_output)
 parse a GDB/MI output record More...
 
bool skip_output_record (UString::size_type a_from, UString::size_type &a_to)
 

Member Enumeration Documentation

◆ Mode

Parsing mode.

Enumerator
UNDEFINED_MODE 
STRICT_MODE 
BROKEN_MODE 

Constructor & Destructor Documentation

◆ GDBMIParser() [1/2]

nemiver::GDBMIParser::GDBMIParser ( Mode  a_mode = STRICT_MODE)
explicit

◆ GDBMIParser() [2/2]

nemiver::GDBMIParser::GDBMIParser ( const UString a_input,
Mode  a_mode = STRICT_MODE 
)
explicit

◆ ~GDBMIParser()

virtual nemiver::GDBMIParser::~GDBMIParser ( )
virtual

Member Function Documentation

◆ get_input()

const UString& nemiver::GDBMIParser::get_input ( ) const

◆ get_mode()

Mode nemiver::GDBMIParser::get_mode ( ) const

◆ parse_asm_instruction_list()

bool nemiver::GDBMIParser::parse_asm_instruction_list ( UString::size_type  a_from,
UString::size_type &  a_to,
std::list< common::Asm > &  a_asm 
)

parse an asm instruction description as returned by GDB/MI

◆ parse_attribute() [1/2]

bool nemiver::GDBMIParser::parse_attribute ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_name,
GDBMIResultSafePtr a_value 
)

◆ parse_attribute() [2/2]

bool nemiver::GDBMIParser::parse_attribute ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_name,
UString a_value 
)

◆ parse_attributes()

bool nemiver::GDBMIParser::parse_attributes ( UString::size_type  a_from,
UString::size_type &  a_to,
map< UString, UString > &  a_attrs 
)

parses an attribute list

An attribute list has the form: attr0="val0",attr1="bal1",attr2="val2"

◆ parse_breakpoint()

bool nemiver::GDBMIParser::parse_breakpoint ( Glib::ustring::size_type  a_from,
Glib::ustring::size_type &  a_to,
IDebugger::Breakpoint a_bkpt 
)

parses a breakpoint definition as returned by gdb.

breakpoint definition string looks like this: bkpt={number="3",type="breakpoint",disp="keep",enabled="y", addr="0x0804860e",func="func2()",file="fooprog.cc",line="13",times="0"}

Parameters
a_inputthe input string to parse.
a_fromwhere to start the parsing from
a_toout parameter. A past the end iterator that point the the end of the parsed text. This is set if and only if the function completes successfuly
a_outputthe output datatructure filled upon parsing.
Returns
true in case of successful parsing, false otherwise.

◆ parse_breakpoint_modified_async_output()

bool nemiver::GDBMIParser::parse_breakpoint_modified_async_output ( UString::size_type  a_from,
UString::size_type &  a_to,
IDebugger::Breakpoint a_b 
)

Parse a GDB/MI async output that says that a breakpoint that was set (e.g before the inferior is run) has changed (e.g after the inferior started to run).

◆ parse_breakpoint_table()

bool nemiver::GDBMIParser::parse_breakpoint_table ( UString::size_type  a_from,
UString::size_type &  a_to,
map< string, IDebugger::Breakpoint > &  a_breakpoints 
)

◆ parse_breakpoint_with_one_loc()

bool nemiver::GDBMIParser::parse_breakpoint_with_one_loc ( Glib::ustring::size_type  a_from,
Glib::ustring::size_type &  a_to,
bool  is_sub_breakpoint,
IDebugger::Breakpoint a_bkpt 
)

◆ parse_c_string()

bool nemiver::GDBMIParser::parse_c_string ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_c_string 
)

parses a string that has the form: "blah"

◆ parse_c_string_body()

bool nemiver::GDBMIParser::parse_c_string_body ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_string 
)

◆ parse_call_stack()

bool nemiver::GDBMIParser::parse_call_stack ( const UString::size_type  a_from,
UString::size_type &  a_to,
vector< IDebugger::Frame > &  a_stack 
)

parse a callstack as returned by the gdb/mi command: -stack-list-frames

◆ parse_changed_registers()

bool nemiver::GDBMIParser::parse_changed_registers ( UString::size_type  a_from,
UString::size_type &  a_to,
std::list< IDebugger::register_id_t > &  a_regs 
)

◆ parse_embedded_c_string()

bool nemiver::GDBMIParser::parse_embedded_c_string ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_string 
)

◆ parse_embedded_c_string_body()

bool nemiver::GDBMIParser::parse_embedded_c_string_body ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_string 
)

◆ parse_file_list()

bool nemiver::GDBMIParser::parse_file_list ( UString::size_type  a_from,
UString::size_type &  a_to,
std::vector< UString > &  a_files 
)

parses the result of the gdbmi command "-file-list-exec-source-files".

◆ parse_frame()

bool nemiver::GDBMIParser::parse_frame ( UString::size_type  a_from,
UString::size_type &  a_to,
IDebugger::Frame a_frame 
)

parses a function frame

function frames have the form: frame={addr="0x080485fa",func="func1",args=[{name="foo", value="bar"}], file="fooprog.cc",fullname="/foo/fooprog.cc",line="6"}

Parameters
a_inputthe input string to parse
a_fromwhere to parse from.
a_toout parameter. Where the parser went after the parsing.
a_framethe parsed frame. It is set if and only if the function returns true.
Returns
true upon successful parsing, false otherwise.

◆ parse_gdbmi_list()

bool nemiver::GDBMIParser::parse_gdbmi_list ( UString::size_type  a_from,
UString::size_type &  a_to,
GDBMIListSafePtr a_list 
)

Parse a GDB/MI LIST. A list is either a list of GDB/MI Results or a list of GDB/MI Values. Look at the GDB/MI output syntax documentation for more.

◆ parse_gdbmi_result()

bool nemiver::GDBMIParser::parse_gdbmi_result ( UString::size_type  a_from,
UString::size_type &  a_to,
GDBMIResultSafePtr a_value 
)

parse a GDB/MI Result data structure. A result basically has the form: variable=value. Beware value is more complicated than what it looks like :-) Look at the GDB/MI spec for more.

◆ parse_gdbmi_string_result()

bool nemiver::GDBMIParser::parse_gdbmi_string_result ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_variable,
UString a_value 
)

Parses a GDB/MI RESULT result=value where value is a string. This is a quick helper that uses parse_gdbmi_result.

◆ parse_gdbmi_tuple()

bool nemiver::GDBMIParser::parse_gdbmi_tuple ( UString::size_type  a_from,
UString::size_type &  a_to,
GDBMITupleSafePtr a_tuple 
)

parse a GDB/MI Tuple is a actualy a set of name=value constructs, where 'value' can be quite complicated. Look at the GDB/MI output syntax for more.

◆ parse_gdbmi_value()

bool nemiver::GDBMIParser::parse_gdbmi_value ( UString::size_type  a_from,
UString::size_type &  a_to,
GDBMIValueSafePtr a_value 
)

parse a GDB/MI value. GDB/MI value type is defined as: VALUE ==> CONST | TUPLE | LIST CONSTis a string, basically. Look at parse_string() for more. TUPLE is a GDB/MI tuple. Look at parse_tuple() for more. LIST is a GDB/MI list. It is either a list of GDB/MI Result or a list of GDB/MI value. Yeah, that can be recursive ... To parse a GDB/MI list, we use parse_list() defined above. You can look at the GDB/MI output syntax for more.

Parameters
a_inputthe input string to parse
a_fromwhere to start parsing from
a_to(out parameter) a pointer to the current char, after the parsing.

◆ parse_local_var_list()

bool nemiver::GDBMIParser::parse_local_var_list ( UString::size_type  a_from,
UString::size_type &  a_to,
list< IDebugger::VariableSafePtr > &  a_vars 
)

parse a list of local variables as returned by the GDBMI command -stack-list-locals 2

◆ parse_member_variable()

bool nemiver::GDBMIParser::parse_member_variable ( const UString::size_type  a_from,
UString::size_type &  a_to,
IDebugger::VariableSafePtr a_var,
bool  a_in_unnamed_var = false 
)

◆ parse_memory_values()

bool nemiver::GDBMIParser::parse_memory_values ( UString::size_type  a_from,
UString::size_type &  a_to,
size_t &  a_start_addr,
std::vector< uint8_t > &  a_values 
)

◆ parse_new_thread_id()

bool nemiver::GDBMIParser::parse_new_thread_id ( UString::size_type  a_from,
UString::size_type &  a_to,
int &  a_thread_id,
IDebugger::Frame a_frame 
)

parses the result of the gdbmi command "-thread-select"

Parameters
a_inputthe input string to parse
a_fromthe offset from where to start the parsing
a_to.out parameter. The next offset after the end of what got parsed.
a_thread_idout parameter. The id of the selected thread.
a_frameout parameter. The current frame in the selected thread.
a_levelout parameter. the level

◆ parse_octal_escape()

bool nemiver::GDBMIParser::parse_octal_escape ( UString::size_type  a_from,
UString::size_type &  a_to,
unsigned char &  a_byte_value 
)

◆ parse_octal_escape_sequence()

bool nemiver::GDBMIParser::parse_octal_escape_sequence ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_result 
)

◆ parse_out_of_band_record()

bool nemiver::GDBMIParser::parse_out_of_band_record ( UString::size_type  a_from,
UString::size_type &  a_to,
Output::OutOfBandRecord a_record 
)

◆ parse_output_record()

bool nemiver::GDBMIParser::parse_output_record ( UString::size_type  a_from,
UString::size_type &  a_to,
Output a_output 
)

parse a GDB/MI output record

◆ parse_overloads_choice_prompt()

bool nemiver::GDBMIParser::parse_overloads_choice_prompt ( UString::size_type  a_from,
UString::size_type &  a_to,
vector< IDebugger::OverloadsChoiceEntry > &  a_prompts 
)

◆ parse_register_names()

bool nemiver::GDBMIParser::parse_register_names ( UString::size_type  a_from,
UString::size_type &  a_to,
std::map< IDebugger::register_id_t, UString > &  a_registers 
)

◆ parse_register_values()

bool nemiver::GDBMIParser::parse_register_values ( UString::size_type  a_from,
UString::size_type &  a_to,
std::map< IDebugger::register_id_t, UString > &  a_values 
)

◆ parse_result_record()

bool nemiver::GDBMIParser::parse_result_record ( UString::size_type  a_from,
UString::size_type &  a_to,
Output::ResultRecord a_record 
)

◆ parse_running_async_output()

bool nemiver::GDBMIParser::parse_running_async_output ( UString::size_type  a_from,
UString::size_type &  a_to,
int &  a_thread_id 
)

parse GDBMI async output that says that the inferior process is running. the string looks like: *running,thread-id="<thread-id>" Note that <thread-id> is either a number, or the string 'all'.

◆ parse_stack_arguments()

bool nemiver::GDBMIParser::parse_stack_arguments ( UString::size_type  a_from,
UString::size_type &  a_to,
map< int, list< IDebugger::VariableSafePtr > > &  a_params 
)

Parse the arguments of the call stack. The call stack arguments is the result of the GDB/MI command -stack-list-arguments 1. It is basically the arguments of the functions of the call stack. See the GDB/MI documentation for more.

◆ parse_stopped_async_output()

bool nemiver::GDBMIParser::parse_stopped_async_output ( UString::size_type  a_from,
UString::size_type &  a_to,
bool &  a_got_frame,
IDebugger::Frame a_frame,
map< UString, UString > &  a_attrs 
)

parse GDBMI async output that says that the debugger has stopped. the string looks like: *stopped,reason="foo",var0="foo0",var1="foo1",frame={<a-frame>}

◆ parse_stream_record()

bool nemiver::GDBMIParser::parse_stream_record ( UString::size_type  a_from,
UString::size_type &  a_to,
Output::StreamRecord a_record 
)

◆ parse_string()

bool nemiver::GDBMIParser::parse_string ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_string 
)

parses a string that has the form: blah

◆ parse_thread_selected_async_output()

bool nemiver::GDBMIParser::parse_thread_selected_async_output ( UString::size_type  a_from,
UString::size_type &  a_to,
int &  a_thread_id 
)

parse GBBMI async output that says which thread was selected in in the inferior the string looks like: =thread-selected,thread-id="<thread-id"

◆ parse_threads_list()

bool nemiver::GDBMIParser::parse_threads_list ( UString::size_type  a_from,
UString::size_type &  a_to,
std::list< int > &  a_thread_ids 
)

parses the result of the gdbmi command "-thread-list-ids".

◆ parse_var_changed_list()

bool nemiver::GDBMIParser::parse_var_changed_list ( UString::size_type  a_from,
UString::size_type &  a_to,
list< VarChangePtr > &  a_var_changes 
)

◆ parse_var_list_children()

bool nemiver::GDBMIParser::parse_var_list_children ( UString::size_type  a_from,
UString::size_type &  a_to,
vector< IDebugger::VariableSafePtr > &  a_vars 
)

◆ parse_var_path_expression()

bool nemiver::GDBMIParser::parse_var_path_expression ( UString::size_type  a_from,
UString::size_type &  a_to,
UString a_expression 
)

◆ parse_variable()

bool nemiver::GDBMIParser::parse_variable ( UString::size_type  a_from,
UString::size_type &  a_to,
IDebugger::VariableSafePtr a_var 
)

◆ parse_variable_format()

bool nemiver::GDBMIParser::parse_variable_format ( UString::size_type  a_from,
UString::size_type &  a_to,
IDebugger::Variable::Format a_format,
UString a_value 
)

◆ parse_variable_value()

bool nemiver::GDBMIParser::parse_variable_value ( const UString::size_type  a_from,
UString::size_type &  a_to,
IDebugger::VariableSafePtr a_var 
)

parse the result of -data-evaluate-expression <var-name> the result is a gdbmi result of the form: value={attrname0=val0, attrname1=val1,...} where val0 and val1 can be simili tuples representing complex types as well.

◆ parse_variables_deleted()

bool nemiver::GDBMIParser::parse_variables_deleted ( UString::size_type  a_from,
UString::size_type &  a_to,
unsigned int &  a_nb_vars_deleted 
)

◆ pop_input()

void nemiver::GDBMIParser::pop_input ( )

◆ push_input()

void nemiver::GDBMIParser::push_input ( const UString a_input)

◆ set_mode()

void nemiver::GDBMIParser::set_mode ( Mode  )

◆ skip_output_record()

bool nemiver::GDBMIParser::skip_output_record ( UString::size_type  a_from,
UString::size_type &  a_to 
)

The documentation for this class was generated from the following file: