From eb1a2e1ef3957213a420bbeedff9c045016e3aa0 Mon Sep 17 00:00:00 2001 From: jlebar Date: Tue, 1 Nov 2011 14:51:15 +0000 Subject: 2011-10-06 Justin Lebar * Makefile.in: (SFILES): Add skip.c. (HFILES_NO_SRCDIR): Add skip.h. (COMMON_OBS): Add skip.o. * skip.h, skip.c: New. * breakpoint.h (set_default_breakpoint): Remove. (get_sal_arch): Declare. * breakpoint.c: Remove default_breakpoint_valid, default_breakpoint_address, default_breakpoint_symtab, default_breakpoint_line, default_breakpoint_pspace variables. (get_sal_arch): Make public. (set_default_breakpoint): Remove. (parse_breakpoint_sals, create_breakpoint, clear_command, decode_line_spec_1): Remove uses of default_breakpoint variables; replaced with function calls into stack.c. * cli/cli-cmds.h: Add cmd_list_element *skiplist. * cli/cli-cmds.c: Add skiplist. (init_cmd_lists): Initialize skiplist. (init_cli_cmds): Fix comment (classes of commands appear in alphabetical order). * infrun.c (handle_inferior_event): Add check that we don't step into a function whose pc is marked for skip. * stack.c: Declare last_displayed_sal_valid, last_displayed_pspace, last_displayed_addr, last_displayed_symtab, last_displayed_line variables. (set_last_displayed_sal): New static function. (print_frame_info): Switch call to set_default_breakpoint to call to set_last_displayed_sal. (clear_last_displayed_sal, last_displayed_sal_is_valid, get_last_displayed_pspace, get_last_displayed_addr, get_last_displayed_symtab, get_last_displayed_line, get_last_displayed_sal): New public functions. * stack.h (clear_last_displayed_sal, last_displayed_sal_is_valid, get_last_displayed_pspace, get_last_displayed_addr, get_last_displayed_symtab, get_last_displayed_line, get_last_displayed_sal): Declare. 2011-10-06 Justin Lebar Add tests for skip command. * testsuite/gdb.base/skip-solib-lib.c: New * testsuite/gdb.base/skip-solib-main.c: New * testsuite/gdb.base/skip-solib.exp: New * testsuite/gdb.base/skip.c: New * testsuite/gdb.base/skip.exp: New * testsuite/gdb.base/skip1.c: New * testsuite/gdb.base/Makefile.in: Adding new files. --- gdb/stack.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 116 insertions(+), 2 deletions(-) (limited to 'gdb/stack.c') diff --git a/gdb/stack.c b/gdb/stack.c index 003725a7252..9136daa3f15 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -96,6 +96,12 @@ static void print_frame (struct frame_info *frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal); +static void set_last_displayed_sal (int valid, + struct program_space *pspace, + CORE_ADDR addr, + struct symtab *symtab, + int line); + /* Zero means do things normally; we are interacting directly with the user. One means print the full filename and linenumber when a frame is printed, and do so in a format emacs18/emacs19.22 can @@ -103,6 +109,14 @@ static void print_frame (struct frame_info *frame, int print_level, cases and in a slightly different syntax. */ int annotation_level = 0; + +/* These variables hold the last symtab and line we displayed to the user. + * This is where we insert a breakpoint or a skiplist entry by default. */ +static int last_displayed_sal_valid = 0; +static struct program_space *last_displayed_pspace = 0; +static CORE_ADDR last_displayed_addr = 0; +static struct symtab *last_displayed_symtab = 0; +static int last_displayed_line = 0; /* Return 1 if we should display the address in addition to the location, @@ -872,9 +886,9 @@ print_frame_info (struct frame_info *frame, int print_level, CORE_ADDR pc; if (get_frame_pc_if_available (frame, &pc)) - set_default_breakpoint (1, sal.pspace, pc, sal.symtab, sal.line); + set_last_displayed_sal (1, sal.pspace, pc, sal.symtab, sal.line); else - set_default_breakpoint (0, 0, 0, 0, 0); + set_last_displayed_sal (0, 0, 0, 0, 0); } annotate_frame_end (); @@ -882,6 +896,106 @@ print_frame_info (struct frame_info *frame, int print_level, gdb_flush (gdb_stdout); } +/* Remember the last symtab and line we displayed, which we use e.g. + * as the place to put a breakpoint when the `break' command is + * invoked with no arguments. */ + +static void +set_last_displayed_sal (int valid, struct program_space *pspace, + CORE_ADDR addr, struct symtab *symtab, + int line) +{ + last_displayed_sal_valid = valid; + last_displayed_pspace = pspace; + last_displayed_addr = addr; + last_displayed_symtab = symtab; + last_displayed_line = line; +} + +/* Forget the last sal we displayed. */ + +void +clear_last_displayed_sal (void) +{ + last_displayed_sal_valid = 0; + last_displayed_pspace = 0; + last_displayed_addr = 0; + last_displayed_symtab = 0; + last_displayed_line = 0; +} + +/* Is our record of the last sal we displayed valid? If not, + * the get_last_displayed_* functions will return NULL or 0, as + * appropriate. */ + +int +last_displayed_sal_is_valid (void) +{ + return last_displayed_sal_valid; +} + +/* Get the pspace of the last sal we displayed, if it's valid. */ + +struct program_space * +get_last_displayed_pspace (void) +{ + if (last_displayed_sal_valid) + return last_displayed_pspace; + return 0; +} + +/* Get the address of the last sal we displayed, if it's valid. */ + +CORE_ADDR +get_last_displayed_addr (void) +{ + if (last_displayed_sal_valid) + return last_displayed_addr; + return 0; +} + +/* Get the symtab of the last sal we displayed, if it's valid. */ + +struct symtab* +get_last_displayed_symtab (void) +{ + if (last_displayed_sal_valid) + return last_displayed_symtab; + return 0; +} + +/* Get the line of the last sal we displayed, if it's valid. */ + +int +get_last_displayed_line (void) +{ + if (last_displayed_sal_valid) + return last_displayed_line; + return 0; +} + +/* Get the last sal we displayed, if it's valid. */ + +void +get_last_displayed_sal (struct symtab_and_line *sal) +{ + if (last_displayed_sal_valid) + { + sal->pspace = last_displayed_pspace; + sal->pc = last_displayed_addr; + sal->symtab = last_displayed_symtab; + sal->line = last_displayed_line; + } + else + { + sal->pspace = 0; + sal->pc = 0; + sal->symtab = 0; + sal->line = 0; + } +} + + /* Attempt to obtain the FUNNAME, FUNLANG and optionally FUNCP of the function corresponding to FRAME. */ -- cgit v1.2.1