From fe39c6533df600944f62d3da7877ad5e4f6d8dbe Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Thu, 24 Oct 2002 21:02:53 +0000 Subject: [PATCH] 2002-10-24 Elena Zannoni * symtab.h (INIT_SAL): Delete macro. (init_sal): Export. * symtab.c (init_sal): New function. * ada-lang.c (ada_finish_decode_line_1): Change INIT_SAL macro to init_sal function call. (find_sal_from_funcs_and_line): Ditto. (all_sals_for_line): Ditto. * breakpoint.c (create_internal_breakpoint): Ditto. (create_fork_vfork_event_catchpoint): Ditto. (create_exec_event_catchpoint): Ditto. (parse_breakpoint_sals): Ditto. (watch_command_1): Ditto. (handle_gnu_4_16_catch_command): Ditto. (clear_command): Ditto. * hppa-tdep.c (child_enable_exception_callback): Ditto. * infcmd.c (run_stack_dummy): Ditto. * infrun.c (process_event_stop_test): Ditto. (check_sigtramp2): Ditto. (step_over_function): Ditto. * linespec.c (decode_line_2): Ditto. (decode_line_1): Ditto. * source.c (line_info): Ditto. * symtab.c (find_pc_sect_line): Ditto. --- gdb/ChangeLog | 27 +++++++++++++++++++++++++++ gdb/ada-lang.c | 6 +++--- gdb/breakpoint.c | 14 +++++++------- gdb/hppa-tdep.c | 2 +- gdb/infcmd.c | 2 +- gdb/infrun.c | 14 +++++++------- gdb/linespec.c | 6 +++--- gdb/source.c | 2 +- gdb/symtab.c | 13 ++++++++++++- gdb/symtab.h | 8 +------- 10 files changed, 63 insertions(+), 31 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index daa56c480f..55077017a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,30 @@ +2002-10-24 Elena Zannoni + + * symtab.h (INIT_SAL): Delete macro. + (init_sal): Export. + * symtab.c (init_sal): New function. + + * ada-lang.c (ada_finish_decode_line_1): Change INIT_SAL macro + to init_sal function call. + (find_sal_from_funcs_and_line): Ditto. + (all_sals_for_line): Ditto. + * breakpoint.c (create_internal_breakpoint): Ditto. + (create_fork_vfork_event_catchpoint): Ditto. + (create_exec_event_catchpoint): Ditto. + (parse_breakpoint_sals): Ditto. + (watch_command_1): Ditto. + (handle_gnu_4_16_catch_command): Ditto. + (clear_command): Ditto. + * hppa-tdep.c (child_enable_exception_callback): Ditto. + * infcmd.c (run_stack_dummy): Ditto. + * infrun.c (process_event_stop_test): Ditto. + (check_sigtramp2): Ditto. + (step_over_function): Ditto. + * linespec.c (decode_line_2): Ditto. + (decode_line_1): Ditto. + * source.c (line_info): Ditto. + * symtab.c (find_pc_sect_line): Ditto. + 2002-10-24 Michal Ludvig * dwarf2cfi.c (struct context) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2838df7e68..2fb691c259 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4395,7 +4395,7 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table, #endif struct minimal_symbol *msymbol; - INIT_SAL (&val); + init_sal (&val); msymbol = NULL; if (lower_name != NULL) @@ -4537,7 +4537,7 @@ done: sals.nelts = 1; sals.sals = (struct symtab_and_line *) xmalloc (sizeof (sals.sals[0])); - INIT_SAL (&sals.sals[0]); + init_sal (&sals.sals[0]); sals.sals[0].line = best_linetable->item[best_index].line; sals.sals[0].pc = best_linetable->item[best_index].pc; @@ -4856,7 +4856,7 @@ all_sals_for_line (const char *filename, int line_num, char ***canonical) break; GROW_VECT (result.sals, len, result.nelts + 1); - INIT_SAL (&result.sals[result.nelts]); + init_sal (&result.sals[result.nelts]); result.sals[result.nelts].line = LINETABLE (s)->item[ind].line; result.sals[result.nelts].pc = LINETABLE (s)->item[ind].pc; result.sals[result.nelts].symtab = s; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c4d8e87d59..7e2326ace1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3884,7 +3884,7 @@ create_internal_breakpoint (CORE_ADDR address, enum bptype type) struct symtab_and_line sal; struct breakpoint *b; - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ sal.pc = address; sal.section = find_pc_overlay (sal.pc); @@ -4204,7 +4204,7 @@ create_fork_vfork_event_catchpoint (int tempflag, char *cond_string, struct breakpoint *b; int thread = -1; /* All threads. */ - INIT_SAL (&sal); + init_sal (&sal); sal.pc = 0; sal.symtab = NULL; sal.line = 0; @@ -4243,7 +4243,7 @@ create_exec_event_catchpoint (int tempflag, char *cond_string) struct breakpoint *b; int thread = -1; /* All threads. */ - INIT_SAL (&sal); + init_sal (&sal); sal.pc = 0; sal.symtab = NULL; sal.line = 0; @@ -4600,7 +4600,7 @@ parse_breakpoint_sals (char **address, if (default_breakpoint_valid) { struct symtab_and_line sal; - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ sals->sals = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line)); sal.pc = default_breakpoint_address; @@ -5296,7 +5296,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty) enum bptype bp_type; int mem_cnt = 0; - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ /* Parse arguments. */ innermost_block = NULL; @@ -6262,7 +6262,7 @@ handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty) char *save_arg; int i; - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ /* If no arg given, or if first arg is 'if ', all active catch clauses are breakpointed. */ @@ -6533,7 +6533,7 @@ clear_command (char *arg, int from_tty) sals.sals = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line)); make_cleanup (xfree, sals.sals); - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ sal.line = default_breakpoint_line; sal.symtab = default_breakpoint_symtab; sal.pc = default_breakpoint_address; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 3890fc2f77..19e44021a0 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -4426,7 +4426,7 @@ child_enable_exception_callback (enum exception_event_kind kind, int enable) { break_callback_sal = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line)); } - INIT_SAL (break_callback_sal); + init_sal (break_callback_sal); break_callback_sal->symtab = NULL; break_callback_sal->pc = eh_break_addr; break_callback_sal->line = 0; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index a36258152c..5359e290e7 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -983,7 +983,7 @@ run_stack_dummy (CORE_ADDR addr, struct regcache *buffer) struct breakpoint *bpt; struct symtab_and_line sal; - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) { sal.pc = CALL_DUMMY_ADDRESS (); diff --git a/gdb/infrun.c b/gdb/infrun.c index 0de1a6608d..88c59c58fd 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2603,7 +2603,7 @@ process_event_stop_test: /* Set up a step-resume breakpoint at the address indicated by SKIP_SOLIB_RESOLVER. */ struct symtab_and_line sr_sal; - INIT_SAL (&sr_sal); + init_sal (&sr_sal); sr_sal.pc = pc_after_resolver; check_for_old_step_resume_breakpoint (); @@ -2656,7 +2656,7 @@ process_event_stop_test: breakpoint even though the signal happened. */ struct symtab_and_line sr_sal; - INIT_SAL (&sr_sal); + init_sal (&sr_sal); sr_sal.symtab = NULL; sr_sal.line = 0; sr_sal.pc = prev_pc; @@ -2769,7 +2769,7 @@ process_event_stop_test: struct symtab_and_line xxx; /* Why isn't this s_a_l called "sr_sal", like all of the other s_a_l's where this code is duplicated? */ - INIT_SAL (&xxx); /* initialize to zeroes */ + init_sal (&xxx); /* initialize to zeroes */ xxx.pc = tmp; xxx.section = find_pc_overlay (xxx.pc); check_for_old_step_resume_breakpoint (); @@ -2844,7 +2844,7 @@ process_event_stop_test: /* And put the step-breakpoint there and go until there. */ struct symtab_and_line sr_sal; - INIT_SAL (&sr_sal); /* initialize to zeroes */ + init_sal (&sr_sal); /* initialize to zeroes */ sr_sal.pc = tmp; sr_sal.section = find_pc_overlay (sr_sal.pc); /* Do not specify what the fp should be when we stop @@ -2960,7 +2960,7 @@ check_sigtramp2 (struct execution_control_state *ecs) struct symtab_and_line sr_sal; - INIT_SAL (&sr_sal); /* initialize to zeroes */ + init_sal (&sr_sal); /* initialize to zeroes */ sr_sal.pc = prev_pc; sr_sal.section = find_pc_overlay (sr_sal.pc); /* We perhaps could set the frame if we kept track of what the @@ -3016,7 +3016,7 @@ step_into_function (struct execution_control_state *ecs) else { /* Put the step-breakpoint there and go until there. */ - INIT_SAL (&sr_sal); /* initialize to zeroes */ + init_sal (&sr_sal); /* initialize to zeroes */ sr_sal.pc = ecs->stop_func_start; sr_sal.section = find_pc_overlay (ecs->stop_func_start); /* Do not specify what the fp should be when we stop since on @@ -3051,7 +3051,7 @@ step_over_function (struct execution_control_state *ecs) { struct symtab_and_line sr_sal; - INIT_SAL (&sr_sal); /* initialize to zeros */ + init_sal (&sr_sal); /* initialize to zeros */ sr_sal.pc = ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame ())); sr_sal.section = find_pc_overlay (sr_sal.pc); diff --git a/gdb/linespec.c b/gdb/linespec.c index bad226e8e2..94f3b731c0 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -367,8 +367,8 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline, printf_unfiltered ("[0] cancel\n[1] all\n"); while (i < nelts) { - INIT_SAL (&return_values.sals[i]); /* initialize to zeroes */ - INIT_SAL (&values.sals[i]); + init_sal (&return_values.sals[i]); /* initialize to zeroes */ + init_sal (&values.sals[i]); if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK) { values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline); @@ -536,7 +536,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, char *saved_arg = *argptr; extern char *gdb_completer_quote_characters; - INIT_SAL (&val); /* initialize to zeroes */ + init_sal (&val); /* initialize to zeroes */ /* Defaults have defaults. */ diff --git a/gdb/source.c b/gdb/source.c index d5528787f7..0107bfa235 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1221,7 +1221,7 @@ line_info (char *arg, int from_tty) CORE_ADDR start_pc, end_pc; int i; - INIT_SAL (&sal); /* initialize to zeroes */ + init_sal (&sal); /* initialize to zeroes */ if (arg == 0) { diff --git a/gdb/symtab.c b/gdb/symtab.c index a55fd110bf..acbfa6538f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -488,6 +488,17 @@ symbol_demangled_name (struct general_symbol_info *gsymbol) /* OBSOLETE (SYMBOL_LANGUAGE (symbol) == language_chill */ /* OBSOLETE ? SYMBOL_CHILL_DEMANGLED_NAME (symbol) */ } + +/* Initialize the structure fields to zero values. */ +void +init_sal (struct symtab_and_line *sal) +{ + sal->symtab = 0; + sal->section = 0; + sal->line = 0; + sal->pc = 0; + sal->end = 0; +} @@ -1823,7 +1834,7 @@ find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent) But what we want is the statement containing the instruction. Fudge the pc to make sure we get that. */ - INIT_SAL (&val); /* initialize to zeroes */ + init_sal (&val); /* initialize to zeroes */ /* It's tempting to assume that, if we can't find debugging info for any function enclosing PC, that we shouldn't search for line diff --git a/gdb/symtab.h b/gdb/symtab.h index 6c18ccb40a..5058c1b6bf 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1207,13 +1207,7 @@ struct symtab_and_line CORE_ADDR end; }; -#define INIT_SAL(sal) { \ - (sal)->symtab = 0; \ - (sal)->section = 0; \ - (sal)->line = 0; \ - (sal)->pc = 0; \ - (sal)->end = 0; \ -} +extern void init_sal (struct symtab_and_line *sal); struct symtabs_and_lines { -- 2.34.1