Interesting case of which nodes of different kinds should be allowed to map to each other

Before

…lines 1–377 unchanged (377 lines)
378static void disassemble_func(void *context,
379 uint64_t addr_start, uint64_t addr_end, bool error,
380 const std::list<std::string> &disasm);
381static void disassemble_pc(void *context,
382 uint64_t addr_start, uint64_t addr_end, bool error,
383 const std::list<std::string> &disasm);
384
385tgdb_callbacks callbacks = {
386 NULL,
387 console_output,
388 command_response,
389 breakpoints,
390 inferiors_source_files,
391 disassemble_func,
392 disassemble_pc
393};
394
395
396/* start_gdb: Starts up libtgdb
397 * Returns: -1 on error, 0 on success
398 */
399static int start_gdb(int argc, char *argv[])
…lines 400–494 unchanged (95 lines)
495{
496 source_set_breakpoints(if_get_sview(), breakpoints);
497 if_show_file(NULL, 0, 0);
498}
499
500/* This means a source file or line number changed */
501static void update_file_position(struct tgdb_response *response)
502{
503 /**
504 * Updating the location that cgdb should point the user to.
505 *
506 * A variety of different locations can come back from gdb.
507 * We currently have the following fields of interest:
…lines 508–515 unchanged (8 lines)
516 * So currently, our best bet is to
517 * - show the file/line
518 * - if file/line unavailable, show the function disassembly
519 * - if function disassembly unavailable, show disassembly
520 * - if disassembly unavailable, show nothing
521 */
522 struct tgdb_file_position *tfp;
523 struct sviewer *sview = if_get_sview();
524 int source_reload_status = -1;
525
526 tfp = response->choice.update_file_position.file_position;
527
528 /* Tell source viewer what the current $pc address is. */
529 sview->addr_frame = tfp->addr;
530
531 /* If we got a pathname and we're not showing disasm... */
532 if (tfp->path && !cgdbrc_get_int(CGDBRC_DISASM)) {
533
534 /**
535 * GDB will provide an executing line number even when the program
536 * has not been started yet. Checking the frame address as well
537 * helps cgdb to not show an executing line unless there is a stack,
538 * which tells us the inferior is running.
539 */
540 int exe_line = sview->addr_frame ? tfp->line_number : -1;
541
542 /* Update the file */
543 source_reload_status =
544 source_reload(if_get_sview(), tfp->path, 0);
545
546 /* Show the source file at this line number */
547 if_show_file(tfp->path, tfp->line_number, exe_line);
548 }
549
550 /**
551 * Sometimes gdb provides a path that can not be found
552 * on disk. For instance, for glibc where the source isn't
553 * available. In this scenario, show the assembly instead.
…lines 554–666 unchanged (113 lines)
667}
668
669static void command_response(void *context, struct tgdb_response *response)
670{
671 switch (response->header)
672 {
673 case TGDB_UPDATE_FILE_POSITION:
674 update_file_position(response);
675 break;
676 case TGDB_QUIT:
677 new_ui_unsupported = response->choice.quit.new_ui_unsupported;
678 cgdb_cleanup_and_exit(0);
679 break;
680 }
681}
…lines 682–701 unchanged (20 lines)
702static void disassemble_pc(void *context,
703 uint64_t addr_start, uint64_t addr_end, bool error,
704 const std::list<std::string> &disasm)
705{
706 update_disassemble(true, addr_start, addr_end, error, disasm);
707}
708
709/* gdb_input: Receives data from tgdb:
710 *
711 * Returns: -1 on error, 0 on success
712 */
713static int gdb_input(int fd)
714{
…lines 715–1186 unchanged (472 lines)

After

…lines 1–377 unchanged (377 lines)
378static void disassemble_func(void *context,
379 uint64_t addr_start, uint64_t addr_end, bool error,
380 const std::list<std::string> &disasm);
381static void disassemble_pc(void *context,
382 uint64_t addr_start, uint64_t addr_end, bool error,
383 const std::list<std::string> &disasm);
384static
385void update_file_pos(void *context,
386 const tgdb_file_position &file_position);
387
388tgdb_callbacks callbacks = {
389 NULL,
390 console_output,
391 command_response,
392 breakpoints,
393 inferiors_source_files,
394 disassemble_func,
395 disassemble_pc,
396 update_file_pos
397};
398
399
400/* start_gdb: Starts up libtgdb
401 * Returns: -1 on error, 0 on success
402 */
…lines 403–498 unchanged (96 lines)
499{
500 source_set_breakpoints(if_get_sview(), breakpoints);
501 if_show_file(NULL, 0, 0);
502}
503
504/* This means a source file or line number changed */
505static void update_file_position(const tgdb_file_position &tfp)
506{
507 /**
508 * Updating the location that cgdb should point the user to.
509 *
510 * A variety of different locations can come back from gdb.
511 * We currently have the following fields of interest:
…lines 512–519 unchanged (8 lines)
520 * So currently, our best bet is to
521 * - show the file/line
522 * - if file/line unavailable, show the function disassembly
523 * - if function disassembly unavailable, show disassembly
524 * - if disassembly unavailable, show nothing
525 */
526 struct sviewer *sview = if_get_sview();
527 int source_reload_status = -1;
528
529 /* Tell source viewer what the current $pc address is. */
530 sview->addr_frame = tfp.addr;
531
532 /* If we got a pathname and we're not showing disasm... */
533 if (tfp.path && !cgdbrc_get_int(CGDBRC_DISASM)) {
534
535 /**
536 * GDB will provide an executing line number even when the program
537 * has not been started yet. Checking the frame address as well
538 * helps cgdb to not show an executing line unless there is a stack,
539 * which tells us the inferior is running.
540 */
541 int exe_line = sview->addr_frame ? tfp.line_number : -1;
542
543 /* Update the file */
544 source_reload_status =
545 source_reload(if_get_sview(), tfp.path, 0);
546
547 /* Show the source file at this line number */
548 if_show_file(tfp.path, tfp.line_number, exe_line);
549 }
550
551 /**
552 * Sometimes gdb provides a path that can not be found
553 * on disk. For instance, for glibc where the source isn't
554 * available. In this scenario, show the assembly instead.
…lines 555–667 unchanged (113 lines)
668}
669
670static void command_response(void *context, struct tgdb_response *response)
671{
672 switch (response->header)
673 {
674 case TGDB_QUIT:
675 new_ui_unsupported = response->choice.quit.new_ui_unsupported;
676 cgdb_cleanup_and_exit(0);
677 break;
678 }
679}
680
…lines 681–700 unchanged (20 lines)
701 uint64_t addr_start, uint64_t addr_end, bool error,
702 const std::list<std::string> &disasm)
703{
704 update_disassemble(true, addr_start, addr_end, error, disasm);
705}
706
707static void update_file_pos(void *context,
708 const tgdb_file_position &file_position)
709{
710 update_file_position(file_position);
711}
712
713/* gdb_input: Receives data from tgdb:
714 *
715 * Returns: -1 on error, 0 on success
716 */
717static int gdb_input(int fd)
…lines 718–1190 unchanged (473 lines)

Before

translation_unit
preproc_if
#if "#if"
identifier "HAVE_CONFIG_H"
"\n"
preproc_include
#include "#include"
string_literal
" "\""
string_content "config.h"
" "\""
#endif "#endif"
comment "/* HAVE_CONFIG_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_SYS_TYPES_H"
preproc_include
#include "#include"
system_lib_string "<sys/types.h>"
#endif "#endif"
comment "/* HAVE_SYS_TYPES_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_FCNTL_H"
preproc_include
#include "#include"
system_lib_string "<fcntl.h>"
#endif "#endif"
comment "/* HAVE_FCNTL_H */"
preproc_if
#if "#if"
identifier "HAVE_UNISTD_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<unistd.h>"
#endif "#endif"
comment "/* HAVE_UNISTD_H */"
preproc_if
#if "#if"
identifier "HAVE_SIGNAL_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<signal.h>"
#endif "#endif"
preproc_if
#if "#if"
identifier "HAVE_STDLIB_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<stdlib.h>"
#endif "#endif"
comment "/* HAVE_STDLIB_H */"
preproc_if
#if "#if"
identifier "HAVE_STDIO_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<stdio.h>"
#endif "#endif"
comment "/* HAVE_STDIO_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_SYS_TIME_H"
preproc_include
#include "#include"
system_lib_string "<sys/time.h>"
#endif "#endif"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_SYS_SELECT_H"
preproc_include
#include "#include"
system_lib_string "<sys/select.h>"
#endif "#endif"
comment "/* HAVE_SYS_SELECT_H */"
preproc_if
#if "#if"
identifier "HAVE_SYS_STAT_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<sys/stat.h>"
#endif "#endif"
preproc_if
#if "#if"
identifier "HAVE_STRING_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<string.h>"
#endif "#endif"
comment "/* HAVE_STRING_H */"
preproc_if
#if "#if"
identifier "HAVE_SYS_IOCTL_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<sys/ioctl.h>"
#endif "#endif"
comment "/* HAVE_SYS_IOCTL_H */"
preproc_if
#if "#if"
identifier "HAVE_ERRNO_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<errno.h>"
#endif "#endif"
comment "/* HAVE_ERRNO_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_GETOPT_H"
preproc_include
#include "#include"
system_lib_string "<getopt.h>"
#endif "#endif"
preproc_if
#if "#if"
identifier "HAVE_CTYPE_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<ctype.h>"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<string>"
preproc_def
#define "#define"
identifier "__STDC_FORMAT_MACROS"
preproc_include
#include "#include"
system_lib_string "<inttypes.h>"
comment "/* Local Includes */"
preproc_include
#include "#include"
string_literal
" "\""
string_content "sys_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "stretchy.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "sys_win.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "cgdb.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "tokenizer.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "highlight_groups.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "interface.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "scroller.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "sources.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "tgdb.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_ctx.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_map_set.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_term.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_manager.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "fs_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "cgdbrc.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "io.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "fork_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "terminal.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "rline.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "usage.h"
" "\""
comment "/* --------- */"
comment "/* Constants */"
comment "/* --------- */"
preproc_def
#define "#define"
identifier "GDB_MAXBUF"
preproc_arg "4096 "
comment "/* GDB input buffer size */"
comment "/* --------------- */"
comment "/* Local Variables */"
comment "/* --------------- */"
declaration
struct_specifier
struct "struct"
type_identifier "tgdb"
pointer_declarator
* "*"
identifier "tgdb"
; ";"
comment "/* The main TGDB context */"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
identifier "cgdb_home_dir"
; ";"
comment "/* Path to home dir with trailing slash */"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
identifier "cgdb_log_dir"
; ";"
comment "/* Path to log dir with trailing slash */"
declaration
storage_class_specifier
static "static"
primitive_type "int"
init_declarator
identifier "gdb_console_fd"
= "="
number_literal "-1"
; ";"
comment "/* GDB console descriptor */"
declaration
storage_class_specifier
static "static"
primitive_type "int"
init_declarator
identifier "gdb_mi_fd"
= "="
number_literal "-1"
; ";"
comment "/* GDB Machine Interface descriptor */"
declaration
storage_class_specifier
static "static"
primitive_type "bool"
init_declarator
identifier "new_ui_unsupported"
= "="
false "false"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "char"
init_declarator
pointer_declarator
* "*"
identifier "debugger_path"
= "="
null
NULL "NULL"
; ";"
comment "/* Path to debugger to use */"
comment "/* Set to 1 if the user requested cgdb to wait for the debug"...
declaration
storage_class_specifier
static "static"
primitive_type "int"
init_declarator
identifier "wait_for_debugger_to_attach"
= "="
number_literal "0"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "unique_ptr"
template_argument_list
< "<"
type_descriptor
type_identifier "kui_manager"
> ">"
identifier "kui_ctx"
; ";"
comment "/* The key input package */"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "shared_ptr"
template_argument_list
< "<"
type_descriptor
type_identifier "kui_map_set"
> ">"
identifier "kui_map"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "shared_ptr"
template_argument_list
< "<"
type_descriptor
type_identifier "kui_map_set"
> ">"
identifier "kui_imap"
; ";"
comment "/**\n * This allows CGDB to know if it is acceptable to read "...
declaration
primitive_type "int"
init_declarator
identifier "kui_input_acceptable"
= "="
number_literal "1"
; ";"
comment "/**\n * This pipe is used for passing SIGWINCH from the handl"...
declaration
primitive_type "int"
init_declarator
array_declarator
identifier "resize_pipe"
[ "["
number_literal "2"
] "]"
= "="
initializer_list
{ "{"
number_literal "-1"
, ","
number_literal "-1"
} "}"
; ";"
comment "/**\n * This pipe is used for passing signals from the handle"...
declaration
primitive_type "int"
init_declarator
array_declarator
identifier "signal_pipe"
[ "["
number_literal "2"
] "]"
= "="
initializer_list
{ "{"
number_literal "-1"
, ","
number_literal "-1"
} "}"
; ";"
comment "/* Original terminal attributes */"
declaration
storage_class_specifier
static "static"
struct_specifier
struct "struct"
type_identifier "termios"
identifier "term_attributes"
; ";"
comment "/**\n * Runs a command in the shell. The shell may be intera"...
function_definition (+212 nodes collapsed)
function_definition (+47 nodes collapsed)
comment "/* ------------------------ */"
comment "/* Initialization functions */"
comment "/* ------------------------ */"
comment "/* version_info: Returns version information about cgdb.\n * "...
function_definition (+82 nodes collapsed)
function_definition (+506 nodes collapsed)
comment "/**\n * Attempts to create a config directory in the user's h"...
function_definition (+189 nodes collapsed)
comment "/**\n * Console output has returned from GDB, show it.\n *\n * "...
function_definition (+43 nodes collapsed)
declaration (+23 nodes collapsed)
declaration (+32 nodes collapsed)
declaration (+35 nodes collapsed)
declaration (+47 nodes collapsed)
declaration (+47 nodes collapsed)
declaration
type_identifier "tgdb_callbacks"
init_declarator
identifier "callbacks"
= "="
initializer_list
{ "{"
null
NULL "NULL"
, ","
identifier "console_output"
, ","
identifier "command_response"
, ","
identifier "breakpoints"
, ","
identifier "inferiors_source_files"
, ","
identifier "disassemble_func"
, ","
identifier "disassemble_pc"
} "}"
; ";"
comment "/* start_gdb: Starts up libtgdb\n * Returns: -1 on error, 0"...
function_definition (+62 nodes collapsed)
function_definition (+41 nodes collapsed)
comment "/* user_input: This function will get a key from the user an"...
function_definition (+317 nodes collapsed)
comment "/**\n * This will usually process all the input that the KUI "...
function_definition (+80 nodes collapsed)
comment "/* This updates all the breakpoints */"
function_definition (+55 nodes collapsed)
comment "/* This means a source file or line number changed */"
function_definition
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "update_file_position"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "tgdb_response"
pointer_declarator
* "*"
identifier "response"
) ")"
compound_statement
{ "{"
comment "/**\n * Updating the location that cgdb should point the "...
declaration
struct_specifier
struct "struct"
type_identifier "tgdb_file_position"
pointer_declarator
* "*"
identifier "tfp"
; ";"
declaration
struct_specifier
struct "struct"
type_identifier "sviewer"
init_declarator
pointer_declarator
* "*"
identifier "sview"
= "="
call_expression
identifier "if_get_sview"
argument_list
( "("
) ")"
; ";"
declaration
primitive_type "int"
init_declarator
identifier "source_reload_status"
= "="
number_literal "-1"
; ";"
expression_statement
assignment_expression
identifier "tfp"
= "="
field_expression
field_expression
field_expression
identifier "response"
-> "->"
field_identifier "choice"
. "."
field_identifier "update_file_position"
. "."
field_identifier "file_position"
; ";"
comment "/* Tell source viewer what the current $pc address is. */"
expression_statement
assignment_expression
field_expression
identifier "sview"
-> "->"
field_identifier "addr_frame"
= "="
field_expression
identifier "tfp"
-> "->"
field_identifier "addr"
; ";"
comment "/* If we got a pathname and we're not showing disasm... */"
if_statement
if "if"
condition_clause
( "("
binary_expression
field_expression
identifier "tfp"
-> "->"
field_identifier "path"
&& "&&"
unary_expression
! "!"
call_expression
identifier "cgdbrc_get_int"
argument_list
( "("
identifier "CGDBRC_DISASM"
) ")"
) ")"
compound_statement
{ "{"
comment "/**\n * GDB will provide an executing line number eve"...
declaration
primitive_type "int"
init_declarator
identifier "exe_line"
= "="
conditional_expression
field_expression
identifier "sview"
-> "->"
field_identifier "addr_frame"
? "?"
field_expression
identifier "tfp"
-> "->"
field_identifier "line_number"
: ":"
number_literal "-1"
; ";"
comment "/* Update the file */"
expression_statement
assignment_expression
identifier "source_reload_status"
= "="
call_expression
identifier "source_reload"
argument_list
( "("
call_expression
identifier "if_get_sview"
argument_list
( "("
) ")"
, ","
field_expression
identifier "tfp"
-> "->"
field_identifier "path"
, ","
number_literal "0"
) ")"
; ";"
comment "/* Show the source file at this line number */"
expression_statement
call_expression
identifier "if_show_file"
argument_list
( "("
field_expression
identifier "tfp"
-> "->"
field_identifier "path"
, ","
field_expression
identifier "tfp"
-> "->"
field_identifier "line_number"
, ","
identifier "exe_line"
) ")"
; ";"
} "}"
comment "/**\n * Sometimes gdb provides a path that can not be fou"...
if_statement (+93 nodes collapsed)
} "}"
comment "/* This is a list of all the source files */"
function_definition (+217 nodes collapsed)
function_definition (+382 nodes collapsed)
function_definition
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "command_response"
parameter_list
( "("
parameter_declaration
primitive_type "void"
pointer_declarator
* "*"
identifier "context"
, ","
parameter_declaration
struct_specifier
struct "struct"
type_identifier "tgdb_response"
pointer_declarator
* "*"
identifier "response"
) ")"
compound_statement
{ "{"
switch_statement
switch "switch"
condition_clause
( "("
field_expression
identifier "response"
-> "->"
field_identifier "header"
) ")"
compound_statement
{ "{"
case_statement
case "case"
identifier "TGDB_UPDATE_FILE_POSITION"
: ":"
expression_statement
call_expression
identifier "update_file_position"
argument_list
( "("
identifier "response"
) ")"
; ";"
break_statement
break "break"
; ";"
case_statement (+30 nodes collapsed)
} "}"
} "}"
function_definition (+42 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+65 nodes collapsed)
function_definition (+65 nodes collapsed)
comment "/* gdb_input: Receives data from tgdb:\n *\n * Returns: -1 o"...
function_definition (+66 nodes collapsed)
function_definition (+161 nodes collapsed)
comment "/**\n * Handles the signals that were received from the main "...
function_definition (+83 nodes collapsed)
function_definition (+536 nodes collapsed)
comment "/* ----------------- */"
comment "/* Exposed Functions */"
comment "/* ----------------- */"
comment "/* cgdb_cleanup_and_exit: Invoked by the various err_xxx fun"...
function_definition (+206 nodes collapsed)
function_definition (+50 nodes collapsed)
function_definition (+53 nodes collapsed)
function_definition (+47 nodes collapsed)
function_definition (+88 nodes collapsed)
function_definition (+258 nodes collapsed)
comment "/**\n * Create the log files.\n */"
function_definition (+120 nodes collapsed)
function_definition (+581 nodes collapsed)

After

translation_unit
preproc_if
#if "#if"
identifier "HAVE_CONFIG_H"
"\n"
preproc_include
#include "#include"
string_literal
" "\""
string_content "config.h"
" "\""
#endif "#endif"
comment "/* HAVE_CONFIG_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_SYS_TYPES_H"
preproc_include
#include "#include"
system_lib_string "<sys/types.h>"
#endif "#endif"
comment "/* HAVE_SYS_TYPES_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_FCNTL_H"
preproc_include
#include "#include"
system_lib_string "<fcntl.h>"
#endif "#endif"
comment "/* HAVE_FCNTL_H */"
preproc_if
#if "#if"
identifier "HAVE_UNISTD_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<unistd.h>"
#endif "#endif"
comment "/* HAVE_UNISTD_H */"
preproc_if
#if "#if"
identifier "HAVE_SIGNAL_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<signal.h>"
#endif "#endif"
preproc_if
#if "#if"
identifier "HAVE_STDLIB_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<stdlib.h>"
#endif "#endif"
comment "/* HAVE_STDLIB_H */"
preproc_if
#if "#if"
identifier "HAVE_STDIO_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<stdio.h>"
#endif "#endif"
comment "/* HAVE_STDIO_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_SYS_TIME_H"
preproc_include
#include "#include"
system_lib_string "<sys/time.h>"
#endif "#endif"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_SYS_SELECT_H"
preproc_include
#include "#include"
system_lib_string "<sys/select.h>"
#endif "#endif"
comment "/* HAVE_SYS_SELECT_H */"
preproc_if
#if "#if"
identifier "HAVE_SYS_STAT_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<sys/stat.h>"
#endif "#endif"
preproc_if
#if "#if"
identifier "HAVE_STRING_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<string.h>"
#endif "#endif"
comment "/* HAVE_STRING_H */"
preproc_if
#if "#if"
identifier "HAVE_SYS_IOCTL_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<sys/ioctl.h>"
#endif "#endif"
comment "/* HAVE_SYS_IOCTL_H */"
preproc_if
#if "#if"
identifier "HAVE_ERRNO_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<errno.h>"
#endif "#endif"
comment "/* HAVE_ERRNO_H */"
preproc_ifdef
#ifdef "#ifdef"
identifier "HAVE_GETOPT_H"
preproc_include
#include "#include"
system_lib_string "<getopt.h>"
#endif "#endif"
preproc_if
#if "#if"
identifier "HAVE_CTYPE_H"
"\n"
preproc_include
#include "#include"
system_lib_string "<ctype.h>"
#endif "#endif"
preproc_include
#include "#include"
system_lib_string "<string>"
preproc_def
#define "#define"
identifier "__STDC_FORMAT_MACROS"
preproc_include
#include "#include"
system_lib_string "<inttypes.h>"
comment "/* Local Includes */"
preproc_include
#include "#include"
string_literal
" "\""
string_content "sys_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "stretchy.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "sys_win.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "cgdb.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "tokenizer.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "highlight_groups.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "interface.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "scroller.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "sources.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "tgdb.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_ctx.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_map_set.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_term.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "kui_manager.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "fs_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "cgdbrc.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "io.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "fork_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "terminal.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "rline.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "usage.h"
" "\""
comment "/* --------- */"
comment "/* Constants */"
comment "/* --------- */"
preproc_def
#define "#define"
identifier "GDB_MAXBUF"
preproc_arg "4096 "
comment "/* GDB input buffer size */"
comment "/* --------------- */"
comment "/* Local Variables */"
comment "/* --------------- */"
declaration
struct_specifier
struct "struct"
type_identifier "tgdb"
pointer_declarator
* "*"
identifier "tgdb"
; ";"
comment "/* The main TGDB context */"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
identifier "cgdb_home_dir"
; ";"
comment "/* Path to home dir with trailing slash */"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
identifier "cgdb_log_dir"
; ";"
comment "/* Path to log dir with trailing slash */"
declaration
storage_class_specifier
static "static"
primitive_type "int"
init_declarator
identifier "gdb_console_fd"
= "="
number_literal "-1"
; ";"
comment "/* GDB console descriptor */"
declaration
storage_class_specifier
static "static"
primitive_type "int"
init_declarator
identifier "gdb_mi_fd"
= "="
number_literal "-1"
; ";"
comment "/* GDB Machine Interface descriptor */"
declaration
storage_class_specifier
static "static"
primitive_type "bool"
init_declarator
identifier "new_ui_unsupported"
= "="
false "false"
; ";"
declaration
storage_class_specifier
static "static"
primitive_type "char"
init_declarator
pointer_declarator
* "*"
identifier "debugger_path"
= "="
null
NULL "NULL"
; ";"
comment "/* Path to debugger to use */"
comment "/* Set to 1 if the user requested cgdb to wait for the debug"...
declaration
storage_class_specifier
static "static"
primitive_type "int"
init_declarator
identifier "wait_for_debugger_to_attach"
= "="
number_literal "0"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "unique_ptr"
template_argument_list
< "<"
type_descriptor
type_identifier "kui_manager"
> ">"
identifier "kui_ctx"
; ";"
comment "/* The key input package */"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "shared_ptr"
template_argument_list
< "<"
type_descriptor
type_identifier "kui_map_set"
> ">"
identifier "kui_map"
; ";"
declaration
qualified_identifier
namespace_identifier "std"
:: "::"
template_type
type_identifier "shared_ptr"
template_argument_list
< "<"
type_descriptor
type_identifier "kui_map_set"
> ">"
identifier "kui_imap"
; ";"
comment "/**\n * This allows CGDB to know if it is acceptable to read "...
declaration
primitive_type "int"
init_declarator
identifier "kui_input_acceptable"
= "="
number_literal "1"
; ";"
comment "/**\n * This pipe is used for passing SIGWINCH from the handl"...
declaration
primitive_type "int"
init_declarator
array_declarator
identifier "resize_pipe"
[ "["
number_literal "2"
] "]"
= "="
initializer_list
{ "{"
number_literal "-1"
, ","
number_literal "-1"
} "}"
; ";"
comment "/**\n * This pipe is used for passing signals from the handle"...
declaration
primitive_type "int"
init_declarator
array_declarator
identifier "signal_pipe"
[ "["
number_literal "2"
] "]"
= "="
initializer_list
{ "{"
number_literal "-1"
, ","
number_literal "-1"
} "}"
; ";"
comment "/* Original terminal attributes */"
declaration
storage_class_specifier
static "static"
struct_specifier
struct "struct"
type_identifier "termios"
identifier "term_attributes"
; ";"
comment "/**\n * Runs a command in the shell. The shell may be intera"...
function_definition (+212 nodes collapsed)
function_definition (+47 nodes collapsed)
comment "/* ------------------------ */"
comment "/* Initialization functions */"
comment "/* ------------------------ */"
comment "/* version_info: Returns version information about cgdb.\n * "...
function_definition (+82 nodes collapsed)
function_definition (+506 nodes collapsed)
comment "/**\n * Attempts to create a config directory in the user's h"...
function_definition (+189 nodes collapsed)
comment "/**\n * Console output has returned from GDB, show it.\n *\n * "...
function_definition (+43 nodes collapsed)
declaration (+23 nodes collapsed)
declaration (+32 nodes collapsed)
declaration (+35 nodes collapsed)
declaration (+47 nodes collapsed)
declaration (+47 nodes collapsed)
declaration
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "update_file_pos"
parameter_list
( "("
parameter_declaration
primitive_type "void"
pointer_declarator
* "*"
identifier "context"
, ","
parameter_declaration
type_qualifier
const "const"
type_identifier "tgdb_file_position"
reference_declarator
& "&"
identifier "file_position"
) ")"
; ";"
declaration
type_identifier "tgdb_callbacks"
init_declarator
identifier "callbacks"
= "="
initializer_list
{ "{"
null
NULL "NULL"
, ","
identifier "console_output"
, ","
identifier "command_response"
, ","
identifier "breakpoints"
, ","
identifier "inferiors_source_files"
, ","
identifier "disassemble_func"
, ","
identifier "disassemble_pc"
, ","
identifier "update_file_pos"
} "}"
; ";"
comment "/* start_gdb: Starts up libtgdb\n * Returns: -1 on error, 0"...
function_definition (+62 nodes collapsed)
function_definition (+41 nodes collapsed)
comment "/* user_input: This function will get a key from the user an"...
function_definition (+317 nodes collapsed)
comment "/**\n * This will usually process all the input that the KUI "...
function_definition (+80 nodes collapsed)
comment "/* This updates all the breakpoints */"
function_definition (+55 nodes collapsed)
comment "/* This means a source file or line number changed */"
function_definition
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "update_file_position"
parameter_list
( "("
parameter_declaration
type_qualifier
const "const"
type_identifier "tgdb_file_position"
reference_declarator
& "&"
identifier "tfp"
) ")"
compound_statement
{ "{"
comment "/**\n * Updating the location that cgdb should point the "...
declaration
struct_specifier
struct "struct"
type_identifier "sviewer"
init_declarator
pointer_declarator
* "*"
identifier "sview"
= "="
call_expression
identifier "if_get_sview"
argument_list
( "("
) ")"
; ";"
declaration
primitive_type "int"
init_declarator
identifier "source_reload_status"
= "="
number_literal "-1"
; ";"
comment "/* Tell source viewer what the current $pc address is. */"
expression_statement
assignment_expression
field_expression
identifier "sview"
-> "->"
field_identifier "addr_frame"
= "="
field_expression
identifier "tfp"
. "."
field_identifier "addr"
; ";"
comment "/* If we got a pathname and we're not showing disasm... */"
if_statement
if "if"
condition_clause
( "("
binary_expression
field_expression
identifier "tfp"
. "."
field_identifier "path"
&& "&&"
unary_expression
! "!"
call_expression
identifier "cgdbrc_get_int"
argument_list
( "("
identifier "CGDBRC_DISASM"
) ")"
) ")"
compound_statement
{ "{"
comment "/**\n * GDB will provide an executing line number eve"...
declaration
primitive_type "int"
init_declarator
identifier "exe_line"
= "="
conditional_expression
field_expression
identifier "sview"
-> "->"
field_identifier "addr_frame"
? "?"
field_expression
identifier "tfp"
. "."
field_identifier "line_number"
: ":"
number_literal "-1"
; ";"
comment "/* Update the file */"
expression_statement
assignment_expression
identifier "source_reload_status"
= "="
call_expression
identifier "source_reload"
argument_list
( "("
call_expression
identifier "if_get_sview"
argument_list
( "("
) ")"
, ","
field_expression
identifier "tfp"
. "."
field_identifier "path"
, ","
number_literal "0"
) ")"
; ";"
comment "/* Show the source file at this line number */"
expression_statement
call_expression
identifier "if_show_file"
argument_list
( "("
field_expression
identifier "tfp"
. "."
field_identifier "path"
, ","
field_expression
identifier "tfp"
. "."
field_identifier "line_number"
, ","
identifier "exe_line"
) ")"
; ";"
} "}"
comment "/**\n * Sometimes gdb provides a path that can not be fou"...
if_statement (+93 nodes collapsed)
} "}"
comment "/* This is a list of all the source files */"
function_definition (+217 nodes collapsed)
function_definition (+382 nodes collapsed)
function_definition
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "command_response"
parameter_list
( "("
parameter_declaration
primitive_type "void"
pointer_declarator
* "*"
identifier "context"
, ","
parameter_declaration
struct_specifier
struct "struct"
type_identifier "tgdb_response"
pointer_declarator
* "*"
identifier "response"
) ")"
compound_statement
{ "{"
switch_statement
switch "switch"
condition_clause
( "("
field_expression
identifier "response"
-> "->"
field_identifier "header"
) ")"
compound_statement
{ "{"
case_statement (+30 nodes collapsed)
} "}"
} "}"
function_definition (+42 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+65 nodes collapsed)
function_definition (+65 nodes collapsed)
function_definition
storage_class_specifier
static "static"
primitive_type "void"
function_declarator
identifier "update_file_pos"
parameter_list
( "("
parameter_declaration
primitive_type "void"
pointer_declarator
* "*"
identifier "context"
, ","
parameter_declaration
type_qualifier
const "const"
type_identifier "tgdb_file_position"
reference_declarator
& "&"
identifier "file_position"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "update_file_position"
argument_list
( "("
identifier "file_position"
) ")"
; ";"
} "}"
comment "/* gdb_input: Receives data from tgdb:\n *\n * Returns: -1 o"...
function_definition (+66 nodes collapsed)
function_definition (+161 nodes collapsed)
comment "/**\n * Handles the signals that were received from the main "...
function_definition (+83 nodes collapsed)
function_definition (+536 nodes collapsed)
comment "/* ----------------- */"
comment "/* Exposed Functions */"
comment "/* ----------------- */"
comment "/* cgdb_cleanup_and_exit: Invoked by the various err_xxx fun"...
function_definition (+206 nodes collapsed)
function_definition (+50 nodes collapsed)
function_definition (+53 nodes collapsed)
function_definition (+47 nodes collapsed)
function_definition (+88 nodes collapsed)
function_definition (+258 nodes collapsed)
comment "/**\n * Create the log files.\n */"
function_definition (+120 nodes collapsed)
function_definition (+581 nodes collapsed)