This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] get rid of INIT_SAL macro
- From: Elena Zannoni <ezannoni at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 23 Oct 2002 19:11:50 -0400
- Subject: [PATCH] get rid of INIT_SAL macro
Will check in tomorrow, as obvious.
Elena
2002-10-23 Elena Zannoni <ezannoni@redhat.com>
* 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.
Index: ada-lang.c
===================================================================
RCS file: /cvs/uberbaum/gdb/ada-lang.c,v
retrieving revision 1.9
diff -u -p -r1.9 ada-lang.c
--- ada-lang.c 8 Sep 2002 17:43:26 -0000 1.9
+++ ada-lang.c 23 Oct 2002 22:42:42 -0000
@@ -4395,7 +4395,7 @@ ada_finish_decode_line_1 (char **spec, s
#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,
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;
Index: breakpoint.c
===================================================================
RCS file: /cvs/uberbaum/gdb/breakpoint.c,v
retrieving revision 1.91
diff -u -p -r1.91 breakpoint.c
--- breakpoint.c 16 Oct 2002 23:25:32 -0000 1.91
+++ breakpoint.c 23 Oct 2002 22:42:48 -0000
@@ -3884,7 +3884,7 @@ create_internal_breakpoint (CORE_ADDR ad
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
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 tempfl
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 accessfl
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
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;
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/uberbaum/gdb/hppa-tdep.c,v
retrieving revision 1.27
diff -u -p -r1.27 hppa-tdep.c
--- hppa-tdep.c 5 May 2002 01:15:13 -0000 1.27
+++ hppa-tdep.c 23 Oct 2002 22:42:53 -0000
@@ -4426,7 +4426,7 @@ child_enable_exception_callback (enum ex
{
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;
Index: infcmd.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infcmd.c,v
retrieving revision 1.57
diff -u -p -r1.57 infcmd.c
--- infcmd.c 3 Oct 2002 02:34:07 -0000 1.57
+++ infcmd.c 23 Oct 2002 22:42:55 -0000
@@ -983,7 +983,7 @@ run_stack_dummy (CORE_ADDR addr, struct
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 ();
Index: infrun.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infrun.c,v
retrieving revision 1.73
diff -u -p -r1.73 infrun.c
--- infrun.c 10 Oct 2002 07:41:37 -0000 1.73
+++ infrun.c 23 Oct 2002 22:42:59 -0000
@@ -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_contro
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_con
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_con
{
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);
Index: linespec.c
===================================================================
RCS file: /cvs/uberbaum/gdb/linespec.c,v
retrieving revision 1.23
diff -u -p -r1.23 linespec.c
--- linespec.c 22 Sep 2002 22:18:41 -0000 1.23
+++ linespec.c 23 Oct 2002 22:43:00 -0000
@@ -371,8 +371,8 @@ decode_line_2 (struct symbol *sym_arr[],
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);
@@ -540,7 +540,7 @@ decode_line_1 (char **argptr, int funfir
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. */
Index: source.c
===================================================================
RCS file: /cvs/uberbaum/gdb/source.c,v
retrieving revision 1.35
diff -u -p -r1.35 source.c
--- source.c 14 Oct 2002 02:12:04 -0000 1.35
+++ source.c 23 Oct 2002 22:43:10 -0000
@@ -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)
{
Index: symtab.c
===================================================================
RCS file: /cvs/uberbaum/gdb/symtab.c,v
retrieving revision 1.72
diff -u -p -r1.72 symtab.c
--- symtab.c 23 Oct 2002 20:09:07 -0000 1.72
+++ symtab.c 23 Oct 2002 22:43:13 -0000
@@ -506,6 +506,17 @@ symbol_demangled_name (struct general_sy
/* 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;
+}
+
@@ -1841,7 +1852,7 @@ find_pc_sect_line (CORE_ADDR pc, struct
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
Index: symtab.h
===================================================================
RCS file: /cvs/uberbaum/gdb/symtab.h,v
retrieving revision 1.48
diff -u -p -r1.48 symtab.h
--- symtab.h 23 Oct 2002 20:09:28 -0000 1.48
+++ symtab.h 23 Oct 2002 23:11:59 -0000
@@ -1199,13 +1199,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
{