This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 05/13] Make a few calls in *-tdep.c for effect
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Thu, 12 Jul 2018 14:52:00 -0600
- Subject: [RFA 05/13] Make a few calls in *-tdep.c for effect
- References: <20180712205208.32646-1-tom@tromey.com>
In a few cases, there were calls in *-tdep.c that I did not want to
remove because I was not certain that it was safe -- perhaps the side
effect of the function (generally throwing an error) was desired.
2018-07-12 Tom Tromey <tom@tromey.com>
* tic6x-tdep.c (tic6x_push_dummy_call): Call find_function_addr
for effect.
* sparc64-tdep.c (adi_examine_command): Call get_adi_info_proc for
effect.
* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Call
find_function_addr for effect.
* nios2-tdep.c (nios2_push_dummy_call): Call find_function_addr
for effect.
* mep-tdep.c (mep_push_dummy_call): Call find_function_addr for
effect.
---
gdb/ChangeLog | 13 +++++++++++++
gdb/mep-tdep.c | 4 +++-
gdb/nios2-tdep.c | 4 +++-
gdb/rs6000-lynx178-tdep.c | 4 +++-
gdb/sparc64-tdep.c | 3 ++-
gdb/tic6x-tdep.c | 4 +++-
6 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index c8a5ecfbe07..0a6fe7de663 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2264,9 +2264,11 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR *copy = (CORE_ADDR *) alloca (argc * sizeof (copy[0]));
- CORE_ADDR func_addr = find_function_addr (function, NULL);
int i;
+ /* Call for side effects. */
+ find_function_addr (function, NULL);
+
/* The number of the next register available to hold an argument. */
int arg_reg;
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 91b4381f0b7..230e39d6671 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1820,9 +1820,11 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int argnum;
int len = 0;
int stack_offset = 0;
- CORE_ADDR func_addr = find_function_addr (function, NULL);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ /* Call for side effects. */
+ find_function_addr (function, NULL);
+
/* Set the return address register to point to the entry point of
the program, where a breakpoint lies in wait. */
regcache_cooked_write_signed (regcache, NIOS2_RA_REGNUM, bp_addr);
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index 13eed3aeaea..cbd235791ea 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -44,7 +44,9 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
gdb_byte tmp_buffer[50];
int f_argno = 0; /* current floating point argno */
int wordsize = gdbarch_tdep (gdbarch)->wordsize;
- CORE_ADDR func_addr = find_function_addr (function, NULL);
+
+ /* Call for side effects. */
+ find_function_addr (function, NULL);
struct value *arg = 0;
struct type *type;
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 8d96cfc0969..e8befaed6ec 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -462,7 +462,8 @@ adi_examine_command (const char *args, int from_tty)
error (_("No ADI information"));
pid_t pid = inferior_ptid.pid ();
- sparc64_adi_info *proc = get_adi_info_proc (pid);
+ /* Call for side effects. */
+ get_adi_info_proc (pid);
int cnt = 1;
const char *p = args;
if (p && *p == '/')
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index efb8b0561b4..6a143422dca 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -882,13 +882,15 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int argnum;
int stack_offset = 4;
int references_offset = 4;
- CORE_ADDR func_addr = find_function_addr (function, NULL);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct type *func_type = value_type (function);
/* The first arg passed on stack. Mostly the first 10 args are passed by
registers. */
int first_arg_on_stack = 10;
+ /* Call for side effects. */
+ find_function_addr (function, NULL);
+
/* Set the return address register to point to the entry point of
the program, where a breakpoint lies in wait. */
regcache_cooked_write_unsigned (regcache, TIC6X_RA_REGNUM, bp_addr);
--
2.13.6