From fee933f19c4956f6f5b8e05bb0e596dcae98b61a Mon Sep 17 00:00:00 2001 From: "K. Richard Pixley" Date: Wed, 8 Sep 1993 21:30:33 +0000 Subject: [PATCH] gcc lint --- gdb/ChangeLog | 9 +++++++ gdb/breakpoint.c | 62 +++++++++++++++++++++++++++++------------------- gdb/buildsym.c | 4 ++-- 3 files changed, 48 insertions(+), 27 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e77cdbaf266..a8e2a15f6ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,15 @@ Wed Sep 8 13:01:10 1993 K. Richard Pixley (rich@cygnus.com) Gcc lint. + * blockframe.c (get_prev_frame_info): initialize address. + * breakpoint.c (bpstat_copy): initialize retval. + (bpstat_stop_status): initialize value_is_zero. + (bpstat_what): initialize bs_class. + (breakpoint_1, mention): add do-nothing case for bp_step_resume. + (break_command_1): initialize cond_end, addr_end, & + canonical_strings_chain. + (enable_breakpoint): initialize save_selected_frame. + * buildsym.c (end_symtab): initialize symtab & linetablesize. * c-exp.y (parse_number): initialize i. * c-typeprint.c (c_type_print_varspec_prefix): include TYPE_CODE_BITSTRING in switch statements and do nothing. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0d29a664bb3..5e955c00894 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -570,7 +570,7 @@ bpstat_copy (bs) { bpstat p = NULL; bpstat tmp; - bpstat retval; + bpstat retval = NULL; if (bs == NULL) return bs; @@ -1100,7 +1100,7 @@ bpstat_stop_status (pc, frame_address) bs->stop = 0; else { - int value_is_zero; + int value_is_zero = 0; if (b->cond) { @@ -1249,7 +1249,7 @@ bpstat_what (bs) for (; bs != NULL; bs = bs->next) { - enum class bs_class; + enum class bs_class = no_effect; if (bs->breakpoint_at == NULL) /* I suspect this can happen if it was a momentary breakpoint which has since been deleted. */ @@ -1352,12 +1352,6 @@ breakpoint_1 (bnum, allflag) static char bpenables[] = "ny"; char wrap_indent[80]; - if (!breakpoint_chain) - { - printf_filtered ("No breakpoints or watchpoints.\n"); - return; - } - ALL_BREAKPOINTS (b) if (bnum == -1 || bnum == b->number) @@ -1409,6 +1403,9 @@ breakpoint_1 (bnum, allflag) } else print_address_symbolic (b->address, stdout, demangle, " "); + /* intentional fall-through */ + case bp_step_resume: /* do nothing. */ + break; } printf_filtered ("\n"); @@ -1434,9 +1431,13 @@ breakpoint_1 (bnum, allflag) } } - if (!found_a_breakpoint - && bnum != -1) - printf_filtered ("No breakpoint or watchpoint number %d.\n", bnum); + if (!found_a_breakpoint) + { + if (bnum == -1) + printf_filtered ("No breakpoints or watchpoints.\n"); + else + printf_filtered ("No breakpoint or watchpoint number %d.\n", bnum); + } else /* Compare against (CORE_ADDR)-1 in case some compiler decides that a comparison of an unsigned with -1 is always false. */ @@ -1743,6 +1744,7 @@ mention (b) case bp_finish: case bp_longjmp: case bp_longjmp_resume: + case bp_step_resume: break; } printf_filtered ("\n"); @@ -1801,13 +1803,13 @@ break_command_1 (arg, tempflag, from_tty) /* Pointers in arg to the start, and one past the end, of the condition. */ char *cond_start = NULL; - char *cond_end; + char *cond_end = NULL; /* Pointers in arg to the start, and one past the end, of the address part. */ char *addr_start = NULL; - char *addr_end; + char *addr_end = NULL; struct cleanup *old_chain; - struct cleanup *canonical_strings_chain; + struct cleanup *canonical_strings_chain = NULL; char **canonical = (char **)NULL; int i; @@ -2615,12 +2617,30 @@ breakpoint_re_set_one (bint) for (i = 0; i < sals.nelts; i++) { resolve_sal_pc (&sals.sals[i]); + + /* Reparse conditions, they might contain references to the + old symtab. */ + if (b->cond_string != NULL) + { + s = b->cond_string; + if (b->cond) + free ((PTR)b->cond); + b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0); + } + + /* We need to re-set the breakpoint if the address changes...*/ if (b->address != sals.sals[i].pc + /* ...or new and old breakpoints both have source files, and + the source file name or the line number changes... */ || (b->source_file != NULL && sals.sals[i].symtab != NULL && (!STREQ (b->source_file, sals.sals[i].symtab->filename) || b->line_number != sals.sals[i].line) - )) + ) + /* ...or we switch between having a source file and not having + one. */ + || ((b->source_file == NULL) != (sals.sals[i].symtab == NULL)) + ) { if (b->source_file != NULL) free (b->source_file); @@ -2632,14 +2652,6 @@ breakpoint_re_set_one (bint) strlen (sals.sals[i].symtab->filename)); b->line_number = sals.sals[i].line; b->address = sals.sals[i].pc; - - if (b->cond_string != NULL) - { - s = b->cond_string; - if (b->cond) - free ((PTR)b->cond); - b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0); - } check_duplicates (b->address); @@ -2824,7 +2836,7 @@ static void enable_breakpoint (bpt) struct breakpoint *bpt; { - FRAME save_selected_frame; + FRAME save_selected_frame = NULL; int save_selected_frame_level = -1; bpt->enable = enabled; diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 48b1a823742..e8804cb57b3 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -653,7 +653,7 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section) struct objfile *objfile; int section; { - register struct symtab *symtab; + register struct symtab *symtab = NULL; register struct blockvector *blockvector; register struct subfile *subfile; register struct context_stack *cstk; @@ -751,7 +751,7 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section) for (subfile = subfiles; subfile; subfile = nextsub) { - int linetablesize; + int linetablesize = 0; /* If we have blocks of symbols, make a symtab. Otherwise, just ignore this file and any line number info in it. */ symtab = NULL; -- 2.30.2