* [PATCH] Multi-process + multi-arch: GDB
@ 2012-11-09 1:52 Pedro Alves
2012-11-09 5:26 ` H.J. Lu
2012-11-09 18:24 ` Tom Tromey
0 siblings, 2 replies; 17+ messages in thread
From: Pedro Alves @ 2012-11-09 1:52 UTC (permalink / raw)
To: gdb-patches
This patch was part of a series I had posted back in
<http://sourceware.org/ml/gdb-patches/2012-04/msg00202.html>. I've
been distracted from that work since then, but since questions similar
or related to "how can we have more than one gdbarch" showed up on the
python architecture thread, I remembered I could push this part in
without the rest. The rest of the series depends on this (and will
need further porting work, since we have more gdbserver ports in the
tree now, and at least a couple more pending...), but this can go in
first and independently. It fixes the issue for native targets.
I had a chance of chatting with Ulrich at FOSDEM earlier in the year,
and he also thought this was a good direction, so I'm putting it in.
Although GDB currently supports debugging multiple inferiors
simultaneously, GDB is not prepared to handle the case of debugging
programs of different architectures (gdbarch's) simultaneously. A
simple example is debugging both a 32-bit and a 64-bit program
simultaneously on x86_64 (think following forks, and 32-bit and/or
64-bit children being spawned), though more complicated examples could
be multi-core setups with processors on the same target (e.g.,
x86_64 + ARM isn't uncommon these days).
E.g., loading both a 64-bit inferior and a 32-bit inferior into GDB
shows (from the test in the patch):
(gdb) file test64
Reading symbols from test64...done.
(gdb) delete breakpoints
(gdb) break main
Breakpoint 1 at 0x40053a: file main.c, line 40.
(gdb) run
Starting program: test64
Breakpoint 1, main () at main.c:40
40 bar();
(gdb) add-inferior
Added inferior 2
inferior 2
[Switching to inferior 2 [<null>] (<noexec>)]
(gdb) file test32
warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Architecture of file not recognized.
The "Architecture of file not recognized" warning is misleading. The
real issue is that target_gdbarch and the target description are
globals. So instead of fetching the target description for the 32-bit
process that was created for the `test32' program, the target
description that was previously fetched for inferior 1 (64-bit) is
assumed, and then things (rightfully) break, as it doesn't really
match inferior 2.
This patch makes target_gdbarch (and the associated description) be
per-inferior instead.
The new test fails without the rest of the patch.
I've made the adjustment Yao pointed out in the old thread.
(Re)tested on x86_64 Fedora 17, and checked in.
gdb/
2012-11-09 Pedro Alves <palves@redhat.com>
* gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro.
(get_target_gdbarch) <gdbarch.h>: New function.
(startup_gdbarch) <gdbarch.h>: Declare.
<gdbarch.c> (target_gdbarch): Delete.
<gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the
current inferior's gdbarch.
<gdbarch.c> (get_target_gdbarch): New function.
* inferior.c: Include target-descriptions.h.
(free_inferior): Free target description info.
(add_inferior_with_spaces): Set the inferior's initial
architecture.
(clone_inferior_command): Copy the original inferior's target
description if it was user specified.
(initialize_inferiors): Add comment.
* inferior.h (struct target_desc_info): Forward declare.
(struct inferior) <gdbarch>: New field.
* linux-nat.c: Include target-descriptions.h.
(linux_child_follow_fork): Copy the parent's architecture and
target description to the child.
* target-descriptions.c: Include inferior.h.
(struct target_desc_info): New structure, holding the equivalents
of ...
(target_desc_fetched, current_target_desc)
(target_description_filename): ... these removed globals.
(get_tdesc_info, target_desc_info_from_user_p)
(copy_inferior_target_desc_info, target_desc_info_free): New.
(target_desc_fetched, current_target_desc)
(target_description_filename): Reimplemented as convenience
macros.
(tdesc_filename_cmd_string): New global.
(set_tdesc_filename_cmd): Copy the string manipulated by the "set
tdescs filename ..." commands to the per-inferior equivalent.
(show_tdesc_filename_cmd): Get the value to show from the
per-inferior description filename.
(_initilize_target_descriptions): Change the "set/show tdesc
filename" commands' variable.
* target-descriptions.h (struct target_desc, struct target_desc_info)
(struct inferior): Forward declare.
(target_find_description, target_clear_description)
(target_current_description): Adjust comments.
(copy_inferior_target_desc_info, target_desc_info_free)
(target_desc_info_from_user_p). Declare.
gdb/testsuite/
2012-11-09 Pedro Alves <palves@redhat.com>
* gdb.multi/multi-arch.exp: New.
---
gdb/gdbarch.c | 11 +++-
gdb/gdbarch.h | 31 +++++++---
gdb/gdbarch.sh | 42 ++++++++++----
gdb/inferior.c | 20 +++++++
gdb/inferior.h | 18 ++++++
gdb/linux-nat.c | 5 ++
gdb/target-descriptions.c | 96 +++++++++++++++++++++++++++-----
gdb/target-descriptions.h | 34 +++++++++--
gdb/testsuite/gdb.multi/multi-arch.exp | 76 +++++++++++++++++++++++++
9 files changed, 285 insertions(+), 48 deletions(-)
create mode 100644 gdb/testsuite/gdb.multi/multi-arch.exp
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 6bc57af..25e4750 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -457,7 +457,6 @@ struct gdbarch startup_gdbarch =
/* startup_gdbarch() */
};
-struct gdbarch *target_gdbarch = &startup_gdbarch;
/* Create a new ``struct gdbarch'' based on information provided by
``struct gdbarch_info''. */
@@ -4671,11 +4670,19 @@ deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
- target_gdbarch = new_gdbarch;
+ current_inferior ()->gdbarch = new_gdbarch;
observer_notify_architecture_changed (new_gdbarch);
registers_changed ();
}
+/* Helper for 'target_gdbarch'. */
+
+struct gdbarch *
+get_target_gdbarch (void)
+{
+ return current_inferior ()->gdbarch;
+}
+
extern void _initialize_gdbarch (void);
void
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 696bf14..5afb3db 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -58,17 +58,26 @@ struct agent_expr;
struct axs_value;
struct stap_parse_info;
-/* The architecture associated with the connection to the target.
-
- The architecture vector provides some information that is really
- a property of the target: The layout of certain packets, for instance;
- or the solib_ops vector. Etc. To differentiate architecture accesses
- to per-target properties from per-thread/per-frame/per-objfile properties,
- accesses to per-target properties should be made through target_gdbarch.
-
- Eventually, when support for multiple targets is implemented in
- GDB, this global should be made target-specific. */
-extern struct gdbarch *target_gdbarch;
+/* The architecture associated with the inferior through the
+ connection to the target.
+
+ The architecture vector provides some information that is really a
+ property of the inferior, accessed through a particular target:
+ ptrace operations; the layout of certain RSP packets; the solib_ops
+ vector; etc. To differentiate architecture accesses to
+ per-inferior/target properties from
+ per-thread/per-frame/per-objfile properties, accesses to
+ per-inferior/target properties should be made through this
+ gdbarch. */
+
+/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
+#define target_gdbarch get_target_gdbarch ()
+extern struct gdbarch *get_target_gdbarch (void);
+
+/* The initial, default architecture. It uses host values (for want of a better
+ choice). */
+extern struct gdbarch startup_gdbarch;
+
/* Callback type for the 'iterate_over_objfiles_in_search_order'
gdbarch method. */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index e3e6329..13d5cc6 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1076,17 +1076,26 @@ struct agent_expr;
struct axs_value;
struct stap_parse_info;
-/* The architecture associated with the connection to the target.
-
- The architecture vector provides some information that is really
- a property of the target: The layout of certain packets, for instance;
- or the solib_ops vector. Etc. To differentiate architecture accesses
- to per-target properties from per-thread/per-frame/per-objfile properties,
- accesses to per-target properties should be made through target_gdbarch.
-
- Eventually, when support for multiple targets is implemented in
- GDB, this global should be made target-specific. */
-extern struct gdbarch *target_gdbarch;
+/* The architecture associated with the inferior through the
+ connection to the target.
+
+ The architecture vector provides some information that is really a
+ property of the inferior, accessed through a particular target:
+ ptrace operations; the layout of certain RSP packets; the solib_ops
+ vector; etc. To differentiate architecture accesses to
+ per-inferior/target properties from
+ per-thread/per-frame/per-objfile properties, accesses to
+ per-inferior/target properties should be made through this
+ gdbarch. */
+
+/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
+#define target_gdbarch get_target_gdbarch ()
+extern struct gdbarch *get_target_gdbarch (void);
+
+/* The initial, default architecture. It uses host values (for want of a better
+ choice). */
+extern struct gdbarch startup_gdbarch;
+
/* Callback type for the 'iterate_over_objfiles_in_search_order'
gdbarch method. */
@@ -1559,7 +1568,6 @@ cat <<EOF
/* startup_gdbarch() */
};
-struct gdbarch *target_gdbarch = &startup_gdbarch;
EOF
# Create a new gdbarch struct
@@ -2278,11 +2286,19 @@ deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
- target_gdbarch = new_gdbarch;
+ current_inferior ()->gdbarch = new_gdbarch;
observer_notify_architecture_changed (new_gdbarch);
registers_changed ();
}
+/* Helper for 'target_gdbarch'. */
+
+struct gdbarch *
+get_target_gdbarch (void)
+{
+ return current_inferior ()->gdbarch;
+}
+
extern void _initialize_gdbarch (void);
void
diff --git a/gdb/inferior.c b/gdb/inferior.c
index f46e1e3..5bb1514 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -33,6 +33,8 @@
#include "environ.h"
#include "cli/cli-utils.h"
#include "continuations.h"
+#include "arch-utils.h"
+#include "target-descriptions.h"
void _initialize_inferiors (void);
@@ -98,6 +100,7 @@ free_inferior (struct inferior *inf)
xfree (inf->args);
xfree (inf->terminal);
free_environ (inf->environment);
+ target_desc_info_free (inf->tdesc_info);
xfree (inf->private);
xfree (inf);
}
@@ -794,6 +797,7 @@ add_inferior_with_spaces (void)
struct address_space *aspace;
struct program_space *pspace;
struct inferior *inf;
+ struct gdbarch_info info;
/* If all inferiors share an address space on this system, this
doesn't really return a new address space; otherwise, it
@@ -804,6 +808,14 @@ add_inferior_with_spaces (void)
inf->pspace = pspace;
inf->aspace = pspace->aspace;
+ /* Setup the inferior's initial arch, based on information obtained
+ from the global "set ..." options. */
+ gdbarch_info_init (&info);
+ inf->gdbarch = gdbarch_find_by_info (info);
+ /* The "set ..." options reject invalid settings, so we should
+ always have a valid arch by now. */
+ gdb_assert (inf->gdbarch != NULL);
+
return inf;
}
@@ -942,6 +954,12 @@ clone_inferior_command (char *args, int from_tty)
inf = add_inferior (0);
inf->pspace = pspace;
inf->aspace = pspace->aspace;
+ inf->gdbarch = orginf->gdbarch;
+
+ /* If the original inferior had a user specified target
+ description, make the clone use it too. */
+ if (target_desc_info_from_user_p (inf->tdesc_info))
+ copy_inferior_target_desc_info (inf, orginf);
printf_filtered (_("Added inferior %d.\n"), inf->num);
@@ -977,6 +995,8 @@ initialize_inferiors (void)
current_inferior_ = add_inferior (0);
current_inferior_->pspace = current_program_space;
current_inferior_->aspace = current_program_space->aspace;
+ /* The architecture will be initialized shortly, by
+ initialize_current_architecture. */
add_info ("inferiors", info_inferiors_command,
_("IDs of specified inferiors (all inferiors if no argument)."));
diff --git a/gdb/inferior.h b/gdb/inferior.h
index b2607c3..e1e7d29 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -30,6 +30,7 @@ struct gdbarch;
struct regcache;
struct ui_out;
struct terminal_info;
+struct target_desc_info;
#include "ptid.h"
@@ -513,6 +514,23 @@ struct inferior
from enum symfile_add_flags. */
int symfile_flags;
+ /* Info about an inferior's target description (if it's fetched; the
+ user supplied description's filename, if any; etc.). */
+ struct target_desc_info *tdesc_info;
+
+ /* The architecture associated with the inferior through the
+ connection to the target.
+
+ The architecture vector provides some information that is really
+ a property of the inferior, accessed through a particular target:
+ ptrace operations; the layout of certain RSP packets; the
+ solib_ops vector; etc. To differentiate architecture accesses to
+ per-inferior/target properties from
+ per-thread/per-frame/per-objfile properties, accesses to
+ per-inferior/target properties should be made through
+ this gdbarch. */
+ struct gdbarch *gdbarch;
+
/* Per inferior data-pointers required by other GDB modules. */
REGISTRY_FIELDS;
};
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 3516565..c282e5d 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -66,6 +66,7 @@
#include "exceptions.h"
#include "linux-ptrace.h"
#include "buffer.h"
+#include "target-descriptions.h"
#ifndef SPUFS_MAGIC
#define SPUFS_MAGIC 0x23c9b64e
@@ -723,6 +724,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
parent_inf = current_inferior ();
child_inf->attach_flag = parent_inf->attach_flag;
copy_terminal_info (child_inf, parent_inf);
+ child_inf->gdbarch = parent_inf->gdbarch;
+ copy_inferior_target_desc_info (child_inf, parent_inf);
old_chain = save_inferior_ptid ();
save_current_program_space ();
@@ -887,6 +890,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
parent_inf = current_inferior ();
child_inf->attach_flag = parent_inf->attach_flag;
copy_terminal_info (child_inf, parent_inf);
+ child_inf->gdbarch = parent_inf->gdbarch;
+ copy_inferior_target_desc_info (child_inf, parent_inf);
parent_pspace = parent_inf->pspace;
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 8b81730..468fe42 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -34,6 +34,7 @@
#include "gdb_assert.h"
#include "gdb_obstack.h"
#include "hashtab.h"
+#include "inferior.h"
/* Types. */
@@ -231,34 +232,92 @@ struct tdesc_arch_data
gdbarch_register_reggroup_p_ftype *pseudo_register_reggroup_p;
};
-/* Global state. These variables are associated with the current
- target; if GDB adds support for multiple simultaneous targets, then
- these variables should become target-specific data. */
+/* Info about an inferior's target description. There's one of these
+ for each inferior. */
-/* A flag indicating that a description has already been fetched from
- the current target, so it should not be queried again. */
+struct target_desc_info
+{
+ /* A flag indicating that a description has already been fetched
+ from the target, so it should not be queried again. */
+
+ int fetched;
-static int target_desc_fetched;
+ /* The description fetched from the target, or NULL if the target
+ did not supply any description. Only valid when
+ target_desc_fetched is set. Only the description initialization
+ code should access this; normally, the description should be
+ accessed through the gdbarch object. */
-/* The description fetched from the current target, or NULL if the
- current target did not supply any description. Only valid when
- target_desc_fetched is set. Only the description initialization
- code should access this; normally, the description should be
- accessed through the gdbarch object. */
+ const struct target_desc *tdesc;
-static const struct target_desc *current_target_desc;
+ /* The filename to read a target description from, as set by "set
+ tdesc filename ..." */
-/* Other global variables. */
+ char *filename;
+};
-/* The filename to read a target description from. */
+/* Get the inferior INF's target description info, allocating one on
+ the stop if necessary. */
-static char *target_description_filename;
+static struct target_desc_info *
+get_tdesc_info (struct inferior *inf)
+{
+ if (inf->tdesc_info == NULL)
+ inf->tdesc_info = XCNEW (struct target_desc_info);
+ return inf->tdesc_info;
+}
/* A handle for architecture-specific data associated with the
target description (see struct tdesc_arch_data). */
static struct gdbarch_data *tdesc_data;
+/* See target-descriptions.h. */
+
+int
+target_desc_info_from_user_p (struct target_desc_info *info)
+{
+ return info != NULL && info->filename != NULL;
+}
+
+/* See target-descriptions.h. */
+
+void
+copy_inferior_target_desc_info (struct inferior *destinf, struct inferior *srcinf)
+{
+ struct target_desc_info *src = get_tdesc_info (srcinf);
+ struct target_desc_info *dest = get_tdesc_info (destinf);
+
+ dest->fetched = src->fetched;
+ dest->tdesc = src->tdesc;
+ dest->filename = src->filename != NULL ? xstrdup (src->filename) : NULL;
+}
+
+/* See target-descriptions.h. */
+
+void
+target_desc_info_free (struct target_desc_info *tdesc_info)
+{
+ if (tdesc_info != NULL)
+ {
+ xfree (tdesc_info->filename);
+ xfree (tdesc_info);
+ }
+}
+
+/* Convenience helper macros. */
+
+#define target_desc_fetched \
+ get_tdesc_info (current_inferior ())->fetched
+#define current_target_desc \
+ get_tdesc_info (current_inferior ())->tdesc
+#define target_description_filename \
+ get_tdesc_info (current_inferior ())->filename
+
+/* The string manipulated by the "set tdesc filename ..." command. */
+
+static char *tdesc_filename_cmd_string;
+
/* Fetch the current target's description, and switch the current
architecture to one which incorporates that description. */
@@ -1510,6 +1569,9 @@ static void
set_tdesc_filename_cmd (char *args, int from_tty,
struct cmd_list_element *c)
{
+ xfree (target_description_filename);
+ target_description_filename = xstrdup (tdesc_filename_cmd_string);
+
target_clear_description ();
target_find_description ();
}
@@ -1519,6 +1581,8 @@ show_tdesc_filename_cmd (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
+ value = target_description_filename;
+
if (value != NULL && *value != '\0')
printf_filtered (_("The target description will be read from \"%s\".\n"),
value);
@@ -1758,7 +1822,7 @@ Unset target description specific variables."),
0 /* allow-unknown */, &unsetlist);
add_setshow_filename_cmd ("filename", class_obscure,
- &target_description_filename,
+ &tdesc_filename_cmd_string,
_("\
Set the file to read for an XML target description"), _("\
Show the file to read for an XML target description"), _("\
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 6a09a90..f0841d1 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -28,23 +28,45 @@ struct tdesc_type;
struct tdesc_reg;
struct target_desc;
struct target_ops;
+struct target_desc;
+/* An inferior's target description info is stored in this opaque
+ object. There's one such object per inferior. */
+struct target_desc_info;
+struct inferior;
-/* Fetch the current target's description, and switch the current
+/* Fetch the current inferior's description, and switch its current
architecture to one which incorporates that description. */
void target_find_description (void);
-/* Discard any description fetched from the current target, and switch
- the current architecture to one with no target description. */
+/* Discard any description fetched from the target for the current
+ inferior, and switch the current architecture to one with no target
+ description. */
void target_clear_description (void);
-/* Return the global current target description. This should only be
- used by gdbarch initialization code; most access should be through
- an existing gdbarch. */
+/* Return the current inferior's target description. This should only
+ be used by gdbarch initialization code; most access should be
+ through an existing gdbarch. */
const struct target_desc *target_current_description (void);
+/* Copy inferior target description data. Used for example when
+ handling (v)forks, where child's description is the same as the
+ parent's, since the child really is a copy of the parent. */
+
+void copy_inferior_target_desc_info (struct inferior *destinf,
+ struct inferior *srcinf);
+
+/* Free a target_desc_info object. */
+
+void target_desc_info_free (struct target_desc_info *tdesc_info);
+
+/* Returns true if INFO indicates the target description had been
+ supplied by the user. */
+
+int target_desc_info_from_user_p (struct target_desc_info *info);
+
/* Record architecture-specific functions to call for pseudo-register
support. If tdesc_use_registers is called and gdbarch_num_pseudo_regs
is greater than zero, then these should be called as well.
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
new file mode 100644
index 0000000..0adc127
--- /dev/null
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -0,0 +1,76 @@
+# Copyright 2009-2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test multi-exec / multi-process features that work for all configurations,
+# even ones that cannot run multiple processes simultaneously.
+
+set testfile "multi-arch"
+
+# The plain remote target can't do multiple inferiors.
+if [target_info exists use_gdb_stub] {
+ return
+}
+
+# Can't use standard_testfile, we want executables with specialized
+# names.
+set exec1 "ma-hello"
+set srcfile1 hello.c
+set binfile1 [standard_output_file ${exec1}]
+
+set exec2 "ma-hangout"
+set srcfile2 hangout.c
+set binfile2 [standard_output_file ${exec2}]
+
+# Build two executables, one for each arch.
+
+if [istarget "s390*-*-*"] {
+ set march1 "-m64"
+ set march2 "-m31"
+} else {
+ set march1 "-m64"
+ set march2 "-m32"
+}
+
+if { [prepare_for_testing ${testfile}.exp ${exec1} "${srcfile1}" \
+ [list debug nowarnings additional_flags=${march1}]] } {
+ return -1
+}
+
+if { [prepare_for_testing ${testfile}.exp ${exec2} "${srcfile2}" \
+ [list debug nowarnings additional_flags=${march2}]] } {
+ return -1
+}
+
+# Start inferior 1
+
+clean_restart ${exec1}
+if ![runto_main] then {
+ fail "starting inferior 1"
+}
+
+# Add and start inferior 2
+
+gdb_test "add-inferior" "Added inferior 2.*" "add empty inferior 2"
+gdb_test "inferior 2" "Switching to inferior 2.*" "switch to inferior 2"
+gdb_load ${binfile2}
+
+if ![runto_main] then {
+ fail "starting inferior 2"
+}
+
+# Check we do have two inferiors loaded.
+
+gdb_test "info inferiors" \
+ "Executable.*${exec2}.*${exec1}.*"
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 1:52 [PATCH] Multi-process + multi-arch: GDB Pedro Alves
@ 2012-11-09 5:26 ` H.J. Lu
2012-11-09 10:07 ` Pedro Alves
2012-11-09 18:24 ` Tom Tromey
1 sibling, 1 reply; 17+ messages in thread
From: H.J. Lu @ 2012-11-09 5:26 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Thu, Nov 8, 2012 at 5:51 PM, Pedro Alves <palves@redhat.com> wrote:
> This patch was part of a series I had posted back in
> <http://sourceware.org/ml/gdb-patches/2012-04/msg00202.html>. I've
> been distracted from that work since then, but since questions similar
> or related to "how can we have more than one gdbarch" showed up on the
> python architecture thread, I remembered I could push this part in
> without the rest. The rest of the series depends on this (and will
> need further porting work, since we have more gdbserver ports in the
> tree now, and at least a couple more pending...), but this can go in
> first and independently. It fixes the issue for native targets.
>
> I had a chance of chatting with Ulrich at FOSDEM earlier in the year,
> and he also thought this was a good direction, so I'm putting it in.
>
> Although GDB currently supports debugging multiple inferiors
> simultaneously, GDB is not prepared to handle the case of debugging
> programs of different architectures (gdbarch's) simultaneously. A
> simple example is debugging both a 32-bit and a 64-bit program
> simultaneously on x86_64 (think following forks, and 32-bit and/or
> 64-bit children being spawned), though more complicated examples could
> be multi-core setups with processors on the same target (e.g.,
> x86_64 + ARM isn't uncommon these days).
>
> E.g., loading both a 64-bit inferior and a 32-bit inferior into GDB
> shows (from the test in the patch):
>
> (gdb) file test64
> Reading symbols from test64...done.
> (gdb) delete breakpoints
> (gdb) break main
> Breakpoint 1 at 0x40053a: file main.c, line 40.
> (gdb) run
> Starting program: test64
>
> Breakpoint 1, main () at main.c:40
> 40 bar();
> (gdb) add-inferior
> Added inferior 2
> inferior 2
> [Switching to inferior 2 [<null>] (<noexec>)]
> (gdb) file test32
> warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Architecture of file not recognized.
>
> The "Architecture of file not recognized" warning is misleading. The
> real issue is that target_gdbarch and the target description are
> globals. So instead of fetching the target description for the 32-bit
> process that was created for the `test32' program, the target
> description that was previously fetched for inferior 1 (64-bit) is
> assumed, and then things (rightfully) break, as it doesn't really
> match inferior 2.
>
> This patch makes target_gdbarch (and the associated description) be
> per-inferior instead.
>
> The new test fails without the rest of the patch.
>
> I've made the adjustment Yao pointed out in the old thread.
>
> (Re)tested on x86_64 Fedora 17, and checked in.
>
> gdb/
> 2012-11-09 Pedro Alves <palves@redhat.com>
>
> * gdbarch.sh (target_gdbarch) <gdbarch.h>: Reimplement as macro.
> (get_target_gdbarch) <gdbarch.h>: New function.
> (startup_gdbarch) <gdbarch.h>: Declare.
> <gdbarch.c> (target_gdbarch): Delete.
> <gdbarch.c> (deprecated_target_gdbarch_select_hack): Set the
> current inferior's gdbarch.
> <gdbarch.c> (get_target_gdbarch): New function.
> * inferior.c: Include target-descriptions.h.
> (free_inferior): Free target description info.
> (add_inferior_with_spaces): Set the inferior's initial
> architecture.
> (clone_inferior_command): Copy the original inferior's target
> description if it was user specified.
> (initialize_inferiors): Add comment.
> * inferior.h (struct target_desc_info): Forward declare.
> (struct inferior) <gdbarch>: New field.
> * linux-nat.c: Include target-descriptions.h.
> (linux_child_follow_fork): Copy the parent's architecture and
> target description to the child.
> * target-descriptions.c: Include inferior.h.
> (struct target_desc_info): New structure, holding the equivalents
> of ...
> (target_desc_fetched, current_target_desc)
> (target_description_filename): ... these removed globals.
> (get_tdesc_info, target_desc_info_from_user_p)
> (copy_inferior_target_desc_info, target_desc_info_free): New.
> (target_desc_fetched, current_target_desc)
> (target_description_filename): Reimplemented as convenience
> macros.
> (tdesc_filename_cmd_string): New global.
> (set_tdesc_filename_cmd): Copy the string manipulated by the "set
> tdescs filename ..." commands to the per-inferior equivalent.
> (show_tdesc_filename_cmd): Get the value to show from the
> per-inferior description filename.
> (_initilize_target_descriptions): Change the "set/show tdesc
> filename" commands' variable.
> * target-descriptions.h (struct target_desc, struct target_desc_info)
> (struct inferior): Forward declare.
> (target_find_description, target_clear_description)
> (target_current_description): Adjust comments.
> (copy_inferior_target_desc_info, target_desc_info_free)
> (target_desc_info_from_user_p). Declare.
>
Does it fix
http://www.sourceware.org/bugzilla/show_bug.cgi?id=14306
--
H.J.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 5:26 ` H.J. Lu
@ 2012-11-09 10:07 ` Pedro Alves
0 siblings, 0 replies; 17+ messages in thread
From: Pedro Alves @ 2012-11-09 10:07 UTC (permalink / raw)
To: H.J. Lu; +Cc: gdb-patches
On 11/09/2012 05:26 AM, H.J. Lu wrote:
> Does it fix
>
> http://www.sourceware.org/bugzilla/show_bug.cgi?id=14306
Not yet. We need to flush the previous target description on execs.
Let do try that.
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 1:52 [PATCH] Multi-process + multi-arch: GDB Pedro Alves
2012-11-09 5:26 ` H.J. Lu
@ 2012-11-09 18:24 ` Tom Tromey
2012-11-09 18:30 ` Pedro Alves
1 sibling, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2012-11-09 18:24 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> +/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
Pedro> +#define target_gdbarch get_target_gdbarch ()
Pedro> +extern struct gdbarch *get_target_gdbarch (void);
I think object-like macros that expand to functions make the code harder
to read.
I can write up a patch to fix this if you agree.
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 18:24 ` Tom Tromey
@ 2012-11-09 18:30 ` Pedro Alves
2012-11-09 18:32 ` Tom Tromey
0 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2012-11-09 18:30 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 11/09/2012 06:24 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> +/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
> Pedro> +#define target_gdbarch get_target_gdbarch ()
> Pedro> +extern struct gdbarch *get_target_gdbarch (void);
>
> I think object-like macros that expand to functions make the code harder
> to read.
>
> I can write up a patch to fix this if you agree.
Please go ahead. 400 lines to touch, but you can easily sed/script it,
I guess. I'd rather keep get_target_gdbarch() than do a full expansion to
"current_inferior ()->gdbarch", though.
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 18:30 ` Pedro Alves
@ 2012-11-09 18:32 ` Tom Tromey
2012-11-09 18:47 ` Pedro Alves
0 siblings, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2012-11-09 18:32 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> Please go ahead. 400 lines to touch, but you can easily
Pedro> sed/script it, I guess. I'd rather keep get_target_gdbarch()
Pedro> than do a full expansion to "current_inferior ()->gdbarch",
Pedro> though.
I was going to keep it, but rename it 'target_gdbarch', and drop the
macro entirely.
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 18:32 ` Tom Tromey
@ 2012-11-09 18:47 ` Pedro Alves
2012-11-09 19:08 ` Tom Tromey
0 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2012-11-09 18:47 UTC (permalink / raw)
To: Tom Tromey; +Cc: Pedro Alves, gdb-patches
On 11/09/2012 06:32 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> Please go ahead. 400 lines to touch, but you can easily
> Pedro> sed/script it, I guess. I'd rather keep get_target_gdbarch()
> Pedro> than do a full expansion to "current_inferior ()->gdbarch",
> Pedro> though.
>
> I was going to keep it, but rename it 'target_gdbarch', and drop the
> macro entirely.
I tried to follow the get_current_arch() precedent (was originally
current_gdbarch). Looking again, I messed up a bit, as get_target_arch()
would be even more in spirit.
But anyway is fine with me. You choose. ;-)
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 18:47 ` Pedro Alves
@ 2012-11-09 19:08 ` Tom Tromey
2012-11-09 19:14 ` Pedro Alves
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Tom Tromey @ 2012-11-09 19:08 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> I tried to follow the get_current_arch() precedent (was originally
Pedro> current_gdbarch). Looking again, I messed up a bit, as get_target_arch()
Pedro> would be even more in spirit.
Pedro> But anyway is fine with me. You choose. ;-)
I picked 'target_gdbarch ()' just due to the long history of using this
name.
Here's the patch, let me know what you think. I made most of it with
'perl -pi'. I only touched gdbarch.sh by hand.
Tested by rebuilding. I use --enable-targets=all, so it has pretty good
coverage of all the changes.
Note the short-ish ChangeLog. I could perhaps write a more detailed
one, but in this case it hardly seemed worthwhile.
Finally, I wonder whether deprecated_target_gdbarch_select_hack should
be un-deprecated. The comment says:
/* Helper function. Set the global "target_gdbarch" to "gdbarch".
FIXME: kettenis/20031124: Of the functions that follow, only
gdbarch_from_bfd is supposed to survive. The others will
dissappear since in the future GDB will (hopefully) be truly
multi-arch. However, for now we're still stuck with the concept of
a single active architecture. */
It seems to me that we have settled on a somewhat different design; but
also that the badness indicated by this comment no longer exists.
Tom
2012-11-09 Tom Tromey <tromey@redhat.com>
* gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
* gdbarch.c, gdbarch.h: Rebuild.
* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
procfs.c, progspace.c, ravenscar-thread.c, record.c,
remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
target-descriptions.c, target.c, target.h, tracepoint.c,
windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/python.c: Update.
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 0e441fb..02ac6d0 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -893,7 +893,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
contains debug information on the task type (due to implicit with of
Ada.Tasking). */
data->known_tasks_element =
- builtin_type (target_gdbarch)->builtin_data_ptr;
+ builtin_type (target_gdbarch ())->builtin_data_ptr;
data->known_tasks_length = MAX_NUMBER_OF_KNOWN_TASKS;
return;
}
@@ -924,7 +924,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
/* Fallback to default values. */
data->known_tasks_element =
- builtin_type (target_gdbarch)->builtin_data_ptr;
+ builtin_type (target_gdbarch ())->builtin_data_ptr;
data->known_tasks_length = 1;
return;
}
@@ -1173,7 +1173,7 @@ info_task (struct ui_out *uiout, char *taskno_str, struct inferior *inf)
/* Print the Ada task ID. */
printf_filtered (_("Ada Task: %s\n"),
- paddress (target_gdbarch, task_info->task_id));
+ paddress (target_gdbarch (), task_info->task_id));
/* Print the name of the task. */
if (task_info->name[0] != '\0')
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c7d73eb..5da6c4e 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -887,7 +887,7 @@ pd_enable (void)
return;
/* Check application word size. */
- arch64 = register_size (target_gdbarch, 0) == 8;
+ arch64 = register_size (target_gdbarch (), 0) == 8;
/* Check whether the application is pthreaded. */
stub_name = NULL;
@@ -901,7 +901,7 @@ pd_enable (void)
if (!(ms = lookup_minimal_symbol (stub_name, NULL, NULL)))
return;
pd_brk_addr = SYMBOL_VALUE_ADDRESS (ms);
- if (!create_thread_event_breakpoint (target_gdbarch, pd_brk_addr))
+ if (!create_thread_event_breakpoint (target_gdbarch (), pd_brk_addr))
return;
/* Prepare for thread debugging. */
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 01982ac..f4a12db 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -443,7 +443,7 @@ ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
{
- if (gdbarch_bfd_arch_info (target_gdbarch)->bits_per_word == 32)
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
{
/* The full structure is found in <asm-i386/ldt.h>. The second
integer is the LDT's base_address and that is used to locate
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index f4414b9..71d17cf 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -506,7 +506,7 @@ gdbarch_update_p (struct gdbarch_info info)
/* If it is the same old architecture, accept the request (but don't
swap anything). */
- if (new_gdbarch == target_gdbarch)
+ if (new_gdbarch == target_gdbarch ())
{
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
@@ -757,7 +757,7 @@ get_current_arch (void)
if (has_stack_frames ())
return get_frame_arch (get_selected_frame (NULL));
else
- return target_gdbarch;
+ return target_gdbarch ();
}
int
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index fbc2479..1a67366 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9195,7 +9195,7 @@ arm_update_current_architecture (void)
struct gdbarch_info info;
/* If the current architecture is not ARM, we have nothing to do. */
- if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_arm)
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_arm)
return;
/* Update the architecture. */
@@ -9229,10 +9229,10 @@ static void
show_fp_model (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
if (arm_fp_model == ARM_FLOAT_AUTO
- && gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_arm)
+ && gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
fprintf_filtered (file, _("\
The current ARM floating point model is \"auto\" (currently \"%s\").\n"),
fp_model_strings[tdep->fp_model]);
@@ -9266,10 +9266,10 @@ static void
arm_show_abi (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
if (arm_abi_global == ARM_ABI_AUTO
- && gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_arm)
+ && gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
fprintf_filtered (file, _("\
The current ARM ABI is \"auto\" (currently \"%s\").\n"),
arm_abi_strings[tdep->arm_abi]);
@@ -9292,7 +9292,7 @@ static void
arm_show_force_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
fprintf_filtered (file,
_("The current execution mode assumed "
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 62628c6..e2aeb21 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -76,7 +76,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
{
struct minimal_symbol *msym;
CORE_ADDR data_address, pointer_address;
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type);
size_t auxv_pair_size = 2 * ptr_size;
gdb_byte *ptr_buf = alloca (ptr_size);
@@ -240,9 +240,9 @@ static int
default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
- const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch)
+ const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch ())
/ TARGET_CHAR_BIT;
- const enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ const enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte *ptr = *readptr;
if (endptr == ptr)
@@ -479,7 +479,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
fprintf_filtered (file, "%s\n", plongest (val));
break;
case hex:
- fprintf_filtered (file, "%s\n", paddress (target_gdbarch, val));
+ fprintf_filtered (file, "%s\n", paddress (target_gdbarch (), val));
break;
case str:
{
@@ -487,8 +487,8 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
get_user_print_options (&opts);
if (opts.addressprint)
- fprintf_filtered (file, "%s ", paddress (target_gdbarch, val));
- val_print_string (builtin_type (target_gdbarch)->builtin_char,
+ fprintf_filtered (file, "%s ", paddress (target_gdbarch (), val));
+ val_print_string (builtin_type (target_gdbarch ())->builtin_char,
NULL, val, -1, file, &opts);
fprintf_filtered (file, "\n");
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 3763a04..d47544b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2792,7 +2792,7 @@ update_inserted_breakpoint_locations (void)
to select an inferior to insert breakpoint to. In fact, even
if we aren't attached to any process yet, we should still
insert breakpoints. */
- if (!gdbarch_has_global_breakpoints (target_gdbarch)
+ if (!gdbarch_has_global_breakpoints (target_gdbarch ())
&& ptid_equal (inferior_ptid, null_ptid))
continue;
@@ -2851,7 +2851,7 @@ insert_breakpoint_locations (void)
to select an inferior to insert breakpoint to. In fact, even
if we aren't attached to any process yet, we should still
insert breakpoints. */
- if (!gdbarch_has_global_breakpoints (target_gdbarch)
+ if (!gdbarch_has_global_breakpoints (target_gdbarch ())
&& ptid_equal (inferior_ptid, null_ptid))
continue;
@@ -3732,7 +3732,7 @@ breakpoint_init_inferior (enum inf_context context)
/* If breakpoint locations are shared across processes, then there's
nothing to do. */
- if (gdbarch_has_global_breakpoints (target_gdbarch))
+ if (gdbarch_has_global_breakpoints (target_gdbarch ()))
return;
ALL_BP_LOCATIONS (bl, blp_tmp)
@@ -5936,7 +5936,7 @@ print_one_breakpoint_location (struct breakpoint *b,
if (loc != NULL
&& !header_of_multiple
&& (allflag
- || (!gdbarch_has_global_breakpoints (target_gdbarch)
+ || (!gdbarch_has_global_breakpoints (target_gdbarch ())
&& (number_of_program_spaces () > 1
|| number_of_inferiors () > 1)
/* LOC is for existing B, it cannot be in
@@ -6596,7 +6596,7 @@ static int
breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1,
struct address_space *aspace2, CORE_ADDR addr2)
{
- return ((gdbarch_has_global_breakpoints (target_gdbarch)
+ return ((gdbarch_has_global_breakpoints (target_gdbarch ())
|| aspace1 == aspace2)
&& addr1 == addr2);
}
@@ -6611,7 +6611,7 @@ breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1,
int len1, struct address_space *aspace2,
CORE_ADDR addr2)
{
- return ((gdbarch_has_global_breakpoints (target_gdbarch)
+ return ((gdbarch_has_global_breakpoints (target_gdbarch ())
|| aspace1 == aspace2)
&& addr2 >= addr1 && addr2 < addr1 + len1);
}
@@ -12529,7 +12529,7 @@ update_global_location_list (int should_insert)
if (breakpoints_always_inserted_mode ()
&& (have_live_inferiors ()
- || (gdbarch_has_global_breakpoints (target_gdbarch))))
+ || (gdbarch_has_global_breakpoints (target_gdbarch ()))))
{
if (should_insert)
insert_breakpoint_locations ();
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 948af8f..fed14d5 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -93,7 +93,7 @@ bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
static void
bsd_uthread_check_magic (CORE_ADDR addr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
ULONGEST magic = read_memory_unsigned_integer (addr, 4, byte_order);
if (magic != BSD_UTHREAD_PTHREAD_MAGIC)
@@ -137,7 +137,7 @@ bsd_uthread_lookup_address (const char *name, struct objfile *objfile)
static int
bsd_uthread_lookup_offset (const char *name, struct objfile *objfile)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr;
addr = bsd_uthread_lookup_address (name, objfile);
@@ -150,7 +150,7 @@ bsd_uthread_lookup_offset (const char *name, struct objfile *objfile)
static CORE_ADDR
bsd_uthread_read_memory_address (CORE_ADDR addr)
{
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
return read_memory_typed_address (addr, ptr_type);
}
@@ -161,7 +161,7 @@ bsd_uthread_read_memory_address (CORE_ADDR addr)
static int
bsd_uthread_activate (struct objfile *objfile)
{
- struct gdbarch *gdbarch = target_gdbarch;
+ struct gdbarch *gdbarch = target_gdbarch ();
struct bsd_uthread_ops *ops = gdbarch_data (gdbarch, bsd_uthread_data);
/* Skip if the thread stratum has already been activated. */
@@ -349,7 +349,7 @@ static ptid_t
bsd_uthread_wait (struct target_ops *ops,
ptid_t ptid, struct target_waitstatus *status, int options)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr;
struct target_ops *beneath = find_target_beneath (ops);
@@ -407,7 +407,7 @@ bsd_uthread_resume (struct target_ops *ops,
static int
bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct target_ops *beneath = find_target_beneath (ops);
CORE_ADDR addr = ptid_get_tid (inferior_ptid);
@@ -484,7 +484,7 @@ static char *bsd_uthread_state[] =
static char *
bsd_uthread_extra_thread_info (struct thread_info *info)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr = ptid_get_tid (info->ptid);
if (addr != 0)
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index dd9c3b8..c2d1397 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -486,10 +486,10 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
if (data->load_offset != 0 || data->load_start != 0 || data->load_end != 0)
printf_filtered (" into memory (%s to %s)\n",
- paddress (target_gdbarch,
+ paddress (target_gdbarch (),
(unsigned long) sec_start
+ sec_offset + data->load_offset),
- paddress (target_gdbarch,
+ paddress (target_gdbarch (),
(unsigned long) sec_start + sec_offset
+ data->load_offset + sec_load_count));
else
diff --git a/gdb/common/agent.c b/gdb/common/agent.c
index 43f1b65..156b154 100644
--- a/gdb/common/agent.c
+++ b/gdb/common/agent.c
@@ -125,7 +125,7 @@ agent_get_helper_thread_id (void)
(unsigned char *) &helper_thread_id,
sizeof helper_thread_id))
#else
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[4];
if (target_read_memory (ipa_sym_addrs.addr_helper_thread_id,
@@ -332,7 +332,7 @@ agent_capability_check (enum agent_capa agent_capa)
(unsigned char *) &agent_capability,
sizeof agent_capability))
#else
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[4];
if (target_read_memory (ipa_sym_addrs.addr_capability,
diff --git a/gdb/corefile.c b/gdb/corefile.c
index a2ed24f..78dbbc2 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -203,11 +203,11 @@ memory_error (int status, CORE_ADDR memaddr)
bounds. */
throw_error (MEMORY_ERROR,
_("Cannot access memory at address %s"),
- paddress (target_gdbarch, memaddr));
+ paddress (target_gdbarch (), memaddr));
else
throw_error (MEMORY_ERROR,
_("Error accessing memory address %s: %s."),
- paddress (target_gdbarch, memaddr),
+ paddress (target_gdbarch (), memaddr),
safe_strerror (status));
}
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index 9741538..67e73e6 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -573,8 +573,8 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
if (print)
{
printf_filtered (_("%s-%s %s/%s %s %s %s"),
- paddress (target_gdbarch, prev_address),
- paddress (target_gdbarch, prev_address + prev_size),
+ paddress (target_gdbarch (), prev_address),
+ paddress (target_gdbarch (), prev_address + prev_size),
unparse_protection (prev_info.protection),
unparse_protection (prev_info.max_protection),
unparse_inheritance (prev_info.inheritance),
@@ -623,7 +623,7 @@ darwin_debug_regions_recurse (task_t task)
table_chain = make_cleanup_ui_out_table_begin_end (uiout, 9, -1, "regions");
- if (gdbarch_addr_bit (target_gdbarch) <= 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
{
ui_out_table_header (uiout, 10, ui_left, "start", "Start");
ui_out_table_header (uiout, 10, ui_left, "end", "End");
@@ -659,8 +659,8 @@ darwin_debug_regions_recurse (task_t task)
break;
row_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "regions-row");
- ui_out_field_core_addr (uiout, "start", target_gdbarch, r_start);
- ui_out_field_core_addr (uiout, "end", target_gdbarch, r_start + r_size);
+ ui_out_field_core_addr (uiout, "start", target_gdbarch (), r_start);
+ ui_out_field_core_addr (uiout, "end", target_gdbarch (), r_start + r_size);
ui_out_field_string (uiout, "min-prot",
unparse_protection (r_info.protection));
ui_out_field_string (uiout, "max-prot",
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 652cfab..ce9fe31 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -589,7 +589,7 @@ dcache_print_line (int index)
db = (struct dcache_block *) n->value;
printf_filtered (_("Line %d: address %s [%d hits]\n"),
- index, paddress (target_gdbarch, db->addr), db->refs);
+ index, paddress (target_gdbarch (), db->addr), db->refs);
for (j = 0; j < last_cache->line_size; j++)
{
@@ -647,7 +647,7 @@ dcache_info (char *exp, int tty)
struct dcache_block *db = (struct dcache_block *) n->value;
printf_filtered (_("Line %d: address %s [%d hits]\n"),
- i, paddress (target_gdbarch, db->addr), db->refs);
+ i, paddress (target_gdbarch (), db->addr), db->refs);
i++;
refcount += db->refs;
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 20ff339..9ea23c0 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -104,8 +104,8 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
have also been used. cagney 1999-09-01 */
printf_filtered ("%s\t: %s .. %s ",
section_name,
- paddress (target_gdbarch, addr),
- paddress (target_gdbarch, addr + size));
+ paddress (target_gdbarch (), addr),
+ paddress (target_gdbarch (), addr + size));
gdb_flush (gdb_stdout);
data_count += size;
@@ -259,7 +259,7 @@ make_srec (char *srec, CORE_ADDR targ_addr, bfd *abfd, asection *sect,
else
internal_error (__FILE__, __LINE__,
_("make_srec: Bad address (%s), or bad flags (0x%x)."),
- paddress (target_gdbarch, targ_addr), flags);
+ paddress (target_gdbarch (), targ_addr), flags);
/* Now that we know the address size, we can figure out how much
data this record can hold. */
diff --git a/gdb/exec.c b/gdb/exec.c
index 2bd3181..615d5c0 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -767,7 +767,7 @@ exec_files_info (struct target_ops *t)
if (vmap)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
struct vmap *vp;
printf_unfiltered (_("\tMapping info for file `%s'.\n"), vmap->name);
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 4a8a509..254a01a 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -125,7 +125,7 @@ fbsd_find_memory_regions (find_memory_region_ftype func, void *obfd)
{
fprintf_filtered (gdb_stdout,
"Save segment, %ld bytes at %s (%c%c%c)\n",
- size, paddress (target_gdbarch, start),
+ size, paddress (target_gdbarch (), start),
read ? 'r' : '-',
write ? 'w' : '-',
exec ? 'x' : '-');
diff --git a/gdb/filesystem.c b/gdb/filesystem.c
index d855b75..5b4b0cf 100644
--- a/gdb/filesystem.c
+++ b/gdb/filesystem.c
@@ -39,7 +39,7 @@ effective_target_file_system_kind (void)
{
if (target_file_system_kind == file_system_kind_auto)
{
- if (gdbarch_has_dos_based_file_system (target_gdbarch))
+ if (gdbarch_has_dos_based_file_system (target_gdbarch ()))
return file_system_kind_dos_based;
else
return file_system_kind_unix;
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 3c8e2f4..5667982 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -75,10 +75,10 @@ write_gcore_file (bfd *obfd)
/* FIXME: uweigand/2011-10-06: All architectures that support core file
generation should be converted to gdbarch_make_corefile_notes; at that
point, the target vector method can be removed. */
- if (!gdbarch_make_corefile_notes_p (target_gdbarch))
+ if (!gdbarch_make_corefile_notes_p (target_gdbarch ()))
note_data = target_make_corefile_notes (obfd, ¬e_size);
else
- note_data = gdbarch_make_corefile_notes (target_gdbarch, obfd, ¬e_size);
+ note_data = gdbarch_make_corefile_notes (target_gdbarch (), obfd, ¬e_size);
if (note_data == NULL || note_size == 0)
error (_("Target does not support core file generation."));
@@ -165,7 +165,7 @@ default_gcore_mach (void)
return 0;
#else
- const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch);
+ const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch ());
if (bfdarch != NULL)
return bfdarch->mach;
@@ -179,7 +179,7 @@ default_gcore_mach (void)
static enum bfd_architecture
default_gcore_arch (void)
{
- const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch);
+ const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch ());
if (bfdarch != NULL)
return bfdarch->arch;
@@ -193,8 +193,8 @@ static const char *
default_gcore_target (void)
{
/* The gdbarch may define a target to use for core files. */
- if (gdbarch_gcore_bfd_target_p (target_gdbarch))
- return gdbarch_gcore_bfd_target (target_gdbarch);
+ if (gdbarch_gcore_bfd_target_p (target_gdbarch ()))
+ return gdbarch_gcore_bfd_target (target_gdbarch ());
/* Otherwise, try to fall back to the exec_bfd target. This will probably
not work for non-ELF targets. */
@@ -398,7 +398,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
if (info_verbose)
{
fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at %s\n",
- plongest (size), paddress (target_gdbarch, vaddr));
+ plongest (size), paddress (target_gdbarch (), vaddr));
}
return 0;
@@ -458,7 +458,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
if (info_verbose)
{
fprintf_filtered (gdb_stdout, "Save segment, %s bytes at %s\n",
- plongest (size), paddress (target_gdbarch, vaddr));
+ plongest (size), paddress (target_gdbarch (), vaddr));
}
bfd_set_section_size (obfd, osec, size);
@@ -554,7 +554,7 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
warning (_("Memory read failed for corefile "
"section, %s bytes at %s."),
plongest (size),
- paddress (target_gdbarch, bfd_section_vma (obfd, osec)));
+ paddress (target_gdbarch (), bfd_section_vma (obfd, osec)));
break;
}
if (!bfd_set_section_contents (obfd, osec, memhunk, offset, size))
@@ -575,8 +575,8 @@ static int
gcore_memory_sections (bfd *obfd)
{
/* Try gdbarch method first, then fall back to target method. */
- if (!gdbarch_find_memory_regions_p (target_gdbarch)
- || gdbarch_find_memory_regions (target_gdbarch,
+ if (!gdbarch_find_memory_regions_p (target_gdbarch ())
+ || gdbarch_find_memory_regions (target_gdbarch (),
gcore_create_callback, obfd) != 0)
{
if (target_find_memory_regions (gcore_create_callback, obfd) != 0)
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 25e4750..26dd404 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4675,10 +4675,10 @@ deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
registers_changed ();
}
-/* Helper for 'target_gdbarch'. */
+/* Return the current inferior's arch. */
struct gdbarch *
-get_target_gdbarch (void)
+target_gdbarch (void)
{
return current_inferior ()->gdbarch;
}
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 5afb3db..9d2bac3 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -71,8 +71,7 @@ struct stap_parse_info;
gdbarch. */
/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
-#define target_gdbarch get_target_gdbarch ()
-extern struct gdbarch *get_target_gdbarch (void);
+extern struct gdbarch *target_gdbarch (void);
/* The initial, default architecture. It uses host values (for want of a better
choice). */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 13d5cc6..53a52b1 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1089,8 +1089,7 @@ struct stap_parse_info;
gdbarch. */
/* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
-#define target_gdbarch get_target_gdbarch ()
-extern struct gdbarch *get_target_gdbarch (void);
+extern struct gdbarch *target_gdbarch (void);
/* The initial, default architecture. It uses host values (for want of a better
choice). */
@@ -2291,10 +2290,10 @@ deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
registers_changed ();
}
-/* Helper for 'target_gdbarch'. */
+/* Return the current inferior's arch. */
struct gdbarch *
-get_target_gdbarch (void)
+target_gdbarch (void)
{
return current_inferior ()->gdbarch;
}
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index b34935e..e6836d7 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2491,7 +2491,7 @@ gnu_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
{
inf_debug (gnu_current_inf, "%s %s[%d] %s %s",
write ? "writing" : "reading",
- paddress (target_gdbarch, memaddr), len,
+ paddress (target_gdbarch (), memaddr), len,
write ? "<--" : "-->", host_address_to_string (myaddr));
if (write)
return gnu_write_inferior (task, memaddr, myaddr, len);
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index 6afbbd0..4680d94 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -415,7 +415,7 @@ i386_darwin_dr_get_control (void)
void
darwin_check_osabi (darwin_inferior *inf, thread_t thread)
{
- if (gdbarch_osabi (target_gdbarch) == GDB_OSABI_UNKNOWN)
+ if (gdbarch_osabi (target_gdbarch ()) == GDB_OSABI_UNKNOWN)
{
/* Attaching to a process. Let's figure out what kind it is. */
x86_thread_state_t gp_regs;
@@ -433,7 +433,7 @@ darwin_check_osabi (darwin_inferior *inf, thread_t thread)
gdbarch_info_init (&info);
gdbarch_info_fill (&info);
- info.byte_order = gdbarch_byte_order (target_gdbarch);
+ info.byte_order = gdbarch_byte_order (target_gdbarch ());
info.osabi = GDB_OSABI_DARWIN;
if (gp_regs.tsh.flavor == x86_THREAD_STATE64)
info.bfd_arch_info = bfd_lookup_arch (bfd_arch_i386,
@@ -457,7 +457,7 @@ darwin_check_osabi (darwin_inferior *inf, thread_t thread)
static int
i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
static const gdb_byte darwin_syscall[] = { 0xcd, 0x80 }; /* int 0x80 */
gdb_byte buf[sizeof (darwin_syscall)];
@@ -490,7 +490,7 @@ i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
static int
amd64_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
static const gdb_byte darwin_syscall[] = { 0x0f, 0x05 }; /* syscall */
gdb_byte buf[sizeof (darwin_syscall)];
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index 559bc29..1d4d620 100644
--- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c
@@ -318,7 +318,7 @@ i386_show_dr (struct i386_debug_reg_state *state,
const char *func, CORE_ADDR addr,
int len, enum target_hw_bp_type type)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
int i;
puts_unfiltered (func);
diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
index 09238fc..9f477df 100644
--- a/gdb/ia64-vms-tdep.c
+++ b/gdb/ia64-vms-tdep.c
@@ -33,7 +33,7 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
unw_proc_info_t *pi,
int need_unwind_info, void *arg)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
unw_dyn_info_t di;
int ret;
gdb_byte buf[32];
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index e6729ac..740798f 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -649,11 +649,11 @@ static int
inf_ptrace_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
- struct type *int_type = builtin_type (target_gdbarch)->builtin_int;
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *int_type = builtin_type (target_gdbarch ())->builtin_int;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
const int sizeof_auxv_type = TYPE_LENGTH (int_type);
const int sizeof_auxv_val = TYPE_LENGTH (ptr_type);
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte *ptr = *readptr;
if (endptr == ptr)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index fd035df..c3e602b 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -469,7 +469,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
/* If the solist is global across processes, there's no need to
refetch it here. */
- if (!gdbarch_has_global_solist (target_gdbarch))
+ if (!gdbarch_has_global_solist (target_gdbarch ()))
{
#ifdef SOLIB_ADD
SOLIB_ADD (NULL, 0, target, auto_solib_add);
@@ -1839,7 +1839,7 @@ program_info (char *args, int from_tty)
target_files_info ();
printf_filtered (_("Program stopped at %s.\n"),
- paddress (target_gdbarch, stop_pc));
+ paddress (target_gdbarch (), stop_pc));
if (tp->control.stop_step)
printf_filtered (_("It stopped after being stepped.\n"));
else if (stat != 0)
@@ -2542,7 +2542,7 @@ attach_command (char *args, int from_tty)
dont_repeat (); /* Not for the faint of heart */
- if (gdbarch_has_global_solist (target_gdbarch))
+ if (gdbarch_has_global_solist (target_gdbarch ()))
/* Don't complain if all processes share the same symbol
space. */
;
@@ -2732,7 +2732,7 @@ detach_command (char *args, int from_tty)
/* If the solist is global across inferiors, don't clear it when we
detach from a single inferior. */
- if (!gdbarch_has_global_solist (target_gdbarch))
+ if (!gdbarch_has_global_solist (target_gdbarch ()))
no_shared_libraries (NULL, from_tty);
/* If we still have inferiors to debug, then don't mess with their
diff --git a/gdb/jit.c b/gdb/jit.c
index 9e8f295..2dcafbc 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -757,7 +757,7 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
priv_data = cb->priv_data;
objfile = allocate_objfile (NULL, 0);
- objfile->gdbarch = target_gdbarch;
+ objfile->gdbarch = target_gdbarch ();
terminate_minimal_symbol_table (objfile);
@@ -1290,7 +1290,7 @@ jit_inferior_init (struct gdbarch *gdbarch)
void
jit_inferior_created_hook (void)
{
- jit_inferior_init (target_gdbarch);
+ jit_inferior_init (target_gdbarch ());
}
/* Exported routine to call to re-set the jit breakpoints,
@@ -1299,7 +1299,7 @@ jit_inferior_created_hook (void)
void
jit_breakpoint_re_set (void)
{
- jit_breakpoint_re_set_internal (target_gdbarch,
+ jit_breakpoint_re_set_internal (target_gdbarch (),
get_jit_inferior_data ());
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c282e5d..45f7e24 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4376,7 +4376,7 @@ linux_nat_make_corefile_notes (bfd *obfd, int *note_size)
{
/* FIXME: uweigand/2011-10-06: Once all GNU/Linux architectures have been
converted to gdbarch_core_regset_sections, this function can go away. */
- return linux_make_corefile_notes (target_gdbarch, obfd, note_size,
+ return linux_make_corefile_notes (target_gdbarch (), obfd, note_size,
linux_nat_collect_thread_registers);
}
@@ -4431,7 +4431,7 @@ linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
static LONGEST
spu_enumerate_spu_ids (int pid, gdb_byte *buf, ULONGEST offset, LONGEST len)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
LONGEST pos = 0;
LONGEST written = 0;
char path[128];
@@ -4640,7 +4640,7 @@ linux_xfer_partial (struct target_ops *ops, enum target_object object,
if (object == TARGET_OBJECT_MEMORY)
{
- int addr_bit = gdbarch_addr_bit (target_gdbarch);
+ int addr_bit = gdbarch_addr_bit (target_gdbarch ());
if (addr_bit < (sizeof (ULONGEST) * HOST_CHAR_BIT))
offset &= ((ULONGEST) 1 << addr_bit) - 1;
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index f02d510..dbeed36 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -667,7 +667,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
"proxydma_info",
};
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte *spu_ids;
LONGEST i, j, size;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index bd90527..c52ab15 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -544,13 +544,13 @@ enable_thread_event (int event, CORE_ADDR *bp)
/* Set up the breakpoint. */
gdb_assert (exec_bfd);
(*bp) = (gdbarch_convert_from_func_ptr_addr
- (target_gdbarch,
+ (target_gdbarch (),
/* Do proper sign extension for the target. */
(bfd_get_sign_extend_vma (exec_bfd) > 0
? (CORE_ADDR) (intptr_t) notify.u.bptaddr
: (CORE_ADDR) (uintptr_t) notify.u.bptaddr),
¤t_target));
- create_thread_event_breakpoint (target_gdbarch, *bp);
+ create_thread_event_breakpoint (target_gdbarch (), *bp);
return TD_OK;
}
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index 4bb4ceb..f74cfe3 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -79,7 +79,7 @@ m32r_load_section (bfd *abfd, asection *s, void *obj)
unsigned int *data_count = obj;
if (s->flags & SEC_LOAD)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
bfd_size_type section_size = bfd_section_size (abfd, s);
bfd_vma section_base = bfd_section_lma (abfd, s);
unsigned int buffer, i;
@@ -89,7 +89,7 @@ m32r_load_section (bfd *abfd, asection *s, void *obj)
printf_filtered ("Loading section %s, size 0x%lx lma ",
bfd_section_name (abfd, s),
(unsigned long) section_size);
- fputs_filtered (paddress (target_gdbarch, section_base), gdb_stdout);
+ fputs_filtered (paddress (target_gdbarch (), section_base), gdb_stdout);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
monitor_printf ("%s mw\r", phex_nz (section_base, addr_size));
@@ -149,7 +149,7 @@ m32r_load (char *filename, int from_tty)
printf_filtered ("Loading section %s, size 0x%lx vma ",
bfd_section_name (abfd, s), section_size);
- fputs_filtered (paddress (target_gdbarch, section_base), gdb_stdout);
+ fputs_filtered (paddress (target_gdbarch (), section_base), gdb_stdout);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
monitor_printf ("%x mw\r", section_base);
@@ -548,7 +548,7 @@ m32r_upload_command (char *args, int from_tty)
printf_filtered ("Loading section %s, size 0x%lx lma ",
bfd_section_name (abfd, s),
(unsigned long) section_size);
- fputs_filtered (paddress (target_gdbarch, section_base),
+ fputs_filtered (paddress (target_gdbarch (), section_base),
gdb_stdout);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
diff --git a/gdb/memattr.c b/gdb/memattr.c
index bd92f1d..39c9b22 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -431,10 +431,10 @@ mem_info_command (char *args, int from_tty)
printf_filtered ("Num ");
printf_filtered ("Enb ");
printf_filtered ("Low Addr ");
- if (gdbarch_addr_bit (target_gdbarch) > 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) > 32)
printf_filtered (" ");
printf_filtered ("High Addr ");
- if (gdbarch_addr_bit (target_gdbarch) > 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) > 32)
printf_filtered (" ");
printf_filtered ("Attrs ");
printf_filtered ("\n");
@@ -446,14 +446,14 @@ mem_info_command (char *args, int from_tty)
printf_filtered ("%-3d %-3c\t",
m->number,
m->enabled_p ? 'y' : 'n');
- if (gdbarch_addr_bit (target_gdbarch) <= 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
tmp = hex_string_custom ((unsigned long) m->lo, 8);
else
tmp = hex_string_custom ((unsigned long) m->lo, 16);
printf_filtered ("%s ", tmp);
- if (gdbarch_addr_bit (target_gdbarch) <= 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
{
if (m->hi == 0)
tmp = "0x100000000";
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index c73d38f..7d00445 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -263,7 +263,7 @@ me_module_register_set (CONFIG_ATTR me_module,
mask contains any of the me_module's coprocessor ISAs,
specifically excluding the generic coprocessor register sets. */
- CGEN_CPU_DESC desc = gdbarch_tdep (target_gdbarch)->cpu_desc;
+ CGEN_CPU_DESC desc = gdbarch_tdep (target_gdbarch ())->cpu_desc;
const CGEN_HW_ENTRY *hw;
if (me_module == CONFIG_NONE)
@@ -854,7 +854,7 @@ current_me_module (void)
return regval;
}
else
- return gdbarch_tdep (target_gdbarch)->me_module;
+ return gdbarch_tdep (target_gdbarch ())->me_module;
}
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index d3c3d81..993f8b0 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -778,7 +778,7 @@ mi_solib_loaded (struct so_list *solib)
struct mi_interp *mi = top_level_interpreter_data ();
target_terminal_ours ();
- if (gdbarch_has_global_solist (target_gdbarch))
+ if (gdbarch_has_global_solist (target_gdbarch ()))
fprintf_unfiltered (mi->event_channel,
"library-loaded,id=\"%s\",target-name=\"%s\","
"host-name=\"%s\",symbols-loaded=\"%d\"",
@@ -802,7 +802,7 @@ mi_solib_unloaded (struct so_list *solib)
struct mi_interp *mi = top_level_interpreter_data ();
target_terminal_ours ();
- if (gdbarch_has_global_solist (target_gdbarch))
+ if (gdbarch_has_global_solist (target_gdbarch ()))
fprintf_unfiltered (mi->event_channel,
"library-unloaded,id=\"%s\",target-name=\"%s\","
"host-name=\"%s\"",
@@ -865,7 +865,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
ui_out_redirect (mi_uiout, mi->event_channel);
ui_out_field_fmt (mi_uiout, "thread-group", "i%d", inferior->num);
- ui_out_field_core_addr (mi_uiout, "addr", target_gdbarch, memaddr);
+ ui_out_field_core_addr (mi_uiout, "addr", target_gdbarch (), memaddr);
ui_out_field_fmt (mi_uiout, "len", "0x%zx", len);
/* Append 'type=code' into notification if MEMADDR falls in the range of
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 9658400..7427912 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -123,7 +123,7 @@ microblaze_register_type (struct gdbarch *gdbarch, int regnum)
static unsigned long
microblaze_fetch_instruction (CORE_ADDR pc)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[4];
/* If we can't read the instruction at PC, return zero. */
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index b9f7f1d..bfcd061 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -688,7 +688,7 @@ mips_show_dr (const char *func, CORE_ADDR addr,
puts_unfiltered (func);
if (addr || len)
printf_unfiltered (" (addr=%s, len=%d, type=%s)",
- paddress (target_gdbarch, addr), len,
+ paddress (target_gdbarch (), addr), len,
type == hw_write ? "data-write"
: (type == hw_read ? "data-read"
: (type == hw_access ? "data-read/write"
@@ -698,9 +698,9 @@ mips_show_dr (const char *func, CORE_ADDR addr,
for (i = 0; i < MAX_DEBUG_REGISTER; i++)
printf_unfiltered ("\tDR%d: lo=%s, hi=%s\n", i,
- paddress (target_gdbarch,
+ paddress (target_gdbarch (),
get_watchlo (&watch_mirror, i)),
- paddress (target_gdbarch,
+ paddress (target_gdbarch (),
get_watchhi (&watch_mirror, i)));
}
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 272e8d9..023290f 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -682,8 +682,8 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
{
unsigned char buf[28], *p;
ULONGEST insn, insn1;
- int n64 = (mips_abi (target_gdbarch) == MIPS_ABI_N64);
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ int n64 = (mips_abi (target_gdbarch ()) == MIPS_ABI_N64);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
read_memory (pc - 12, buf, 28);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 2af4c89..61f2cd2 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1087,7 +1087,7 @@ static void
show_mask_address (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
deprecated_show_value_hack (file, from_tty, c, value);
switch (mask_address_var)
@@ -6652,7 +6652,7 @@ show_mipsfpu_command (char *args, int from_tty)
{
char *fpu;
- if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
{
printf_unfiltered
("The MIPS floating-point coprocessor is unknown "
@@ -6660,7 +6660,7 @@ show_mipsfpu_command (char *args, int from_tty)
return;
}
- switch (MIPS_FPU_TYPE (target_gdbarch))
+ switch (MIPS_FPU_TYPE (target_gdbarch ()))
{
case MIPS_FPU_SINGLE:
fpu = "single-precision";
@@ -8681,7 +8681,7 @@ show_mips_abi (struct ui_file *file,
struct cmd_list_element *ignored_cmd,
const char *ignored_value)
{
- if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
fprintf_filtered
(file,
"The MIPS ABI is unknown because the current architecture "
@@ -8689,7 +8689,7 @@ show_mips_abi (struct ui_file *file,
else
{
enum mips_abi global_abi = global_mips_abi ();
- enum mips_abi actual_abi = mips_abi (target_gdbarch);
+ enum mips_abi actual_abi = mips_abi (target_gdbarch ());
const char *actual_abi_str = mips_abi_strings[actual_abi];
if (global_abi == MIPS_ABI_UNKNOWN)
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 4812736..850c273 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -217,11 +217,11 @@ monitor_error (char *function, char *message,
if (final_char)
error (_("%s (%s): %s: %s%c"),
- function, paddress (target_gdbarch, memaddr),
+ function, paddress (target_gdbarch (), memaddr),
message, safe_string, final_char);
else
error (_("%s (%s): %s: %s"),
- function, paddress (target_gdbarch, memaddr),
+ function, paddress (target_gdbarch (), memaddr),
message, safe_string);
}
@@ -256,7 +256,7 @@ fromhex (int a)
static void
monitor_vsprintf (char *sndbuf, char *pattern, va_list args)
{
- int addr_bit = gdbarch_addr_bit (target_gdbarch);
+ int addr_bit = gdbarch_addr_bit (target_gdbarch ());
char format[10];
char fmt;
char *p;
@@ -1440,15 +1440,15 @@ monitor_files_info (struct target_ops *ops)
static int
monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
unsigned int val, hostval;
char *cmd;
int i;
- monitor_debug ("MON write %d %s\n", len, paddress (target_gdbarch, memaddr));
+ monitor_debug ("MON write %d %s\n", len, paddress (target_gdbarch (), memaddr));
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
- memaddr = gdbarch_addr_bits_remove (target_gdbarch, memaddr);
+ memaddr = gdbarch_addr_bits_remove (target_gdbarch (), memaddr);
/* Use memory fill command for leading 0 bytes. */
@@ -1707,7 +1707,7 @@ monitor_write_memory_block (CORE_ADDR memaddr, char *myaddr, int len)
static int
monitor_read_memory_single (CORE_ADDR memaddr, char *myaddr, int len)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
unsigned int val;
char membuf[sizeof (int) * 2 + 1];
char *p;
@@ -1852,11 +1852,11 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
}
monitor_debug ("MON read block ta(%s) ha(%s) %d\n",
- paddress (target_gdbarch, memaddr),
+ paddress (target_gdbarch (), memaddr),
host_address_to_string (myaddr), len);
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
- memaddr = gdbarch_addr_bits_remove (target_gdbarch, memaddr);
+ memaddr = gdbarch_addr_bits_remove (target_gdbarch (), memaddr);
if (current_monitor->flags & MO_GETMEM_READ_SINGLE)
return monitor_read_memory_single (memaddr, myaddr, len);
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 5a04ecc..f8a4528 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -505,7 +505,7 @@ moxie_process_readu (CORE_ADDR addr, char *buf,
if (record_debug)
printf_unfiltered (_("Process record: error reading memory at "
"addr 0x%s len = %d.\n"),
- paddress (target_gdbarch, addr), length);
+ paddress (target_gdbarch (), addr), length);
return -1;
}
@@ -528,7 +528,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog, "Process record: moxie_process_record "
"addr = 0x%s\n",
- paddress (target_gdbarch, addr));
+ paddress (target_gdbarch (), addr));
inst = (uint16_t) moxie_process_readu (addr, buf, 2, byte_order);
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index b58f318..cf33a02 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -197,7 +197,7 @@ procfs_open (char *arg, int from_tty)
{
if (sysinfo->type !=
nto_map_arch_to_cputype (gdbarch_bfd_arch_info
- (target_gdbarch)->arch_name))
+ (target_gdbarch ())->arch_name))
error (_("Invalid target CPU."));
}
}
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index fddd548..7c48946 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -94,14 +94,14 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
"%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
nto_root = nto_target ();
- if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "i386") == 0)
+ if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
{
arch = "x86";
endian = "";
}
- else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name,
+ else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
"rs6000") == 0
- || strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name,
+ || strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
"powerpc") == 0)
{
arch = "ppc";
@@ -109,8 +109,8 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
}
else
{
- arch = gdbarch_bfd_arch_info (target_gdbarch)->arch_name;
- endian = gdbarch_byte_order (target_gdbarch)
+ arch = gdbarch_bfd_arch_info (target_gdbarch ())->arch_name;
+ endian = gdbarch_byte_order (target_gdbarch ())
== BFD_ENDIAN_BIG ? "be" : "le";
}
@@ -150,14 +150,14 @@ nto_init_solib_absolute_prefix (void)
const char *arch;
nto_root = nto_target ();
- if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "i386") == 0)
+ if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
{
arch = "x86";
endian = "";
}
- else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name,
+ else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
"rs6000") == 0
- || strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name,
+ || strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
"powerpc") == 0)
{
arch = "ppc";
@@ -165,8 +165,8 @@ nto_init_solib_absolute_prefix (void)
}
else
{
- arch = gdbarch_bfd_arch_info (target_gdbarch)->arch_name;
- endian = gdbarch_byte_order (target_gdbarch)
+ arch = gdbarch_bfd_arch_info (target_gdbarch ())->arch_name;
+ endian = gdbarch_byte_order (target_gdbarch ())
== BFD_ENDIAN_BIG ? "be" : "le";
}
@@ -261,7 +261,7 @@ lm_addr (struct so_list *so)
if (so->lm_info->l_addr == (CORE_ADDR)-1)
{
struct link_map_offsets *lmo = nto_fetch_link_map_offsets ();
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
so->lm_info->l_addr =
extract_typed_address (so->lm_info->lm + lmo->l_addr_offset, ptr_type);
@@ -272,12 +272,12 @@ lm_addr (struct so_list *so)
static CORE_ADDR
nto_truncate_ptr (CORE_ADDR addr)
{
- if (gdbarch_ptr_bit (target_gdbarch) == sizeof (CORE_ADDR) * 8)
+ if (gdbarch_ptr_bit (target_gdbarch ()) == sizeof (CORE_ADDR) * 8)
/* We don't need to truncate anything, and the bit twiddling below
will fail due to overflow problems. */
return addr;
else
- return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch)) - 1);
+ return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch ())) - 1);
}
static Elf_Internal_Phdr *
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 14f4ecb..ef94a48 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -2394,7 +2394,7 @@ ppc_linux_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
int sizeof_auxv_field = ppc_linux_target_wordsize ();
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte *ptr = *readptr;
if (endptr == ptr)
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index a1f90a8..68df6e9 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -269,7 +269,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
struct regcache *regcache;
inferior_ptid = BUILD_LWP (lwpid, ptid_get_pid (ph->ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
@@ -288,7 +288,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
struct regcache *regcache;
inferior_ptid = BUILD_LWP (lwpid, ptid_get_pid (ph->ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
@@ -308,7 +308,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
struct regcache *regcache;
inferior_ptid = BUILD_LWP (lwpid, ptid_get_pid (ph->ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
@@ -328,7 +328,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
struct regcache *regcache;
inferior_ptid = BUILD_LWP (lwpid, ptid_get_pid (ph->ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index c03165a..82c7cd0 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -159,7 +159,7 @@ static int
procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte *ptr = *readptr;
if (endptr == ptr)
@@ -1206,12 +1206,12 @@ proc_watchpoint_address (procinfo *pi, CORE_ADDR *addr)
return 0;
#ifdef NEW_PROC_API
- *addr = (CORE_ADDR) gdbarch_pointer_to_address (target_gdbarch,
- builtin_type (target_gdbarch)->builtin_data_ptr,
+ *addr = (CORE_ADDR) gdbarch_pointer_to_address (target_gdbarch (),
+ builtin_type (target_gdbarch ())->builtin_data_ptr,
(gdb_byte *) &pi->prstatus.pr_lwp.pr_info.si_addr);
#else
- *addr = (CORE_ADDR) gdbarch_pointer_to_address (target_gdbarch,
- builtin_type (target_gdbarch)->builtin_data_ptr,
+ *addr = (CORE_ADDR) gdbarch_pointer_to_address (target_gdbarch (),
+ builtin_type (target_gdbarch ())->builtin_data_ptr,
(gdb_byte *) &pi->prstatus.pr_info.si_addr);
#endif
return 1;
@@ -2455,11 +2455,11 @@ proc_parent_pid (procinfo *pi)
static void *
procfs_address_to_host_pointer (CORE_ADDR addr)
{
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
void *ptr;
gdb_assert (sizeof (ptr) == TYPE_LENGTH (ptr_type));
- gdbarch_address_to_pointer (target_gdbarch, ptr_type,
+ gdbarch_address_to_pointer (target_gdbarch (), ptr_type,
(gdb_byte *) &ptr, addr);
return ptr;
}
@@ -3430,7 +3430,7 @@ remove_dbx_link_breakpoint (void)
if (dbx_link_bpt_addr == 0)
return;
- if (deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt) != 0)
+ if (deprecated_remove_raw_breakpoint (target_gdbarch (), dbx_link_bpt) != 0)
warning (_("Unable to remove __dbx_link breakpoint."));
dbx_link_bpt_addr = 0;
@@ -3503,7 +3503,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
{
/* Insert the breakpoint. */
dbx_link_bpt_addr = sym_addr;
- dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch, NULL,
+ dbx_link_bpt = deprecated_insert_raw_breakpoint (target_gdbarch (), NULL,
sym_addr);
if (dbx_link_bpt == NULL)
{
@@ -4118,7 +4118,7 @@ invalidate_cache (procinfo *parent, procinfo *pi, void *ptr)
if (!proc_set_gregs (pi)) /* flush gregs cache */
proc_warn (pi, "target_resume, set_gregs",
__LINE__);
- if (gdbarch_fp0_regnum (target_gdbarch) >= 0)
+ if (gdbarch_fp0_regnum (target_gdbarch ()) >= 0)
if (pi->fpregs_dirty)
if (parent == NULL ||
proc_get_current_thread (parent) != pi->tid)
@@ -4396,7 +4396,7 @@ procfs_mourn_inferior (struct target_ops *ops)
if (dbx_link_bpt != NULL)
{
- deprecated_remove_raw_breakpoint (target_gdbarch, dbx_link_bpt);
+ deprecated_remove_raw_breakpoint (target_gdbarch (), dbx_link_bpt);
dbx_link_bpt_addr = 0;
dbx_link_bpt = NULL;
}
@@ -4881,7 +4881,7 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
procfs_address_to_host_pointer will reveal that an internal error
will be generated when the host and target pointer sizes are
different. */
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
if (sizeof (void *) != TYPE_LENGTH (ptr_type))
return 0;
@@ -4938,7 +4938,7 @@ procfs_insert_watchpoint (CORE_ADDR addr, int len, int type,
struct expression *cond)
{
if (!target_have_steppable_watchpoint
- && !gdbarch_have_nonsteppable_watchpoint (target_gdbarch))
+ && !gdbarch_have_nonsteppable_watchpoint (target_gdbarch ()))
{
/* When a hardware watchpoint fires off the PC will be left at
the instruction following the one which caused the
@@ -5138,7 +5138,7 @@ info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore,
pr_off = map->pr_off;
#endif
- if (gdbarch_addr_bit (target_gdbarch) == 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) == 32)
printf_filtered ("\t%#10lx %#10lx %#10lx %#10x %7s\n",
(unsigned long) map->pr_vaddr,
(unsigned long) map->pr_vaddr + map->pr_size - 1,
@@ -5165,7 +5165,7 @@ info_proc_mappings (procinfo *pi, int summary)
return; /* No output for summary mode. */
printf_filtered (_("Mapped address spaces:\n\n"));
- if (gdbarch_ptr_bit (target_gdbarch) == 32)
+ if (gdbarch_ptr_bit (target_gdbarch ()) == 32)
printf_filtered ("\t%10s %10s %10s %10s %7s\n",
"Start Addr",
" End Addr",
diff --git a/gdb/progspace.c b/gdb/progspace.c
index db8c5a3..ff5af0d 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -75,7 +75,7 @@ new_address_space (void)
struct address_space *
maybe_new_address_space (void)
{
- int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch);
+ int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch ());
if (shared_aspace)
{
@@ -148,7 +148,7 @@ release_program_space (struct program_space *pspace)
no_shared_libraries (NULL, 0);
exec_close ();
free_all_objfiles ();
- if (!gdbarch_has_shared_address_space (target_gdbarch))
+ if (!gdbarch_has_shared_address_space (target_gdbarch ()))
free_address_space (pspace->aspace);
resize_section_table (&pspace->target_sections,
-resize_section_table (&pspace->target_sections, 0));
@@ -432,7 +432,7 @@ number_of_program_spaces (void)
void
update_address_spaces (void)
{
- int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch);
+ int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch ());
struct program_space *pspace;
struct inferior *inf;
@@ -454,7 +454,7 @@ update_address_spaces (void)
}
for (inf = inferior_list; inf; inf = inf->next)
- if (gdbarch_has_global_solist (target_gdbarch))
+ if (gdbarch_has_global_solist (target_gdbarch ()))
inf->aspace = maybe_new_address_space ();
else
inf->aspace = inf->pspace->aspace;
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 56ab775..7b2d319 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -392,7 +392,7 @@ bpfinishpy_handle_stop (struct bpstats *bs, int print_frame)
static void
bpfinishpy_handle_exit (struct inferior *inf)
{
- struct cleanup *cleanup = ensure_python_env (target_gdbarch,
+ struct cleanup *cleanup = ensure_python_env (target_gdbarch (),
current_language);
iterate_over_breakpoints (bpfinishpy_detect_out_scope_cb, NULL);
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 211a643..8acf87b 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -101,7 +101,7 @@ python_on_resume (ptid_t ptid)
{
struct cleanup *cleanup;
- cleanup = ensure_python_env (target_gdbarch, current_language);
+ cleanup = ensure_python_env (target_gdbarch (), current_language);
if (emit_continue_event (ptid) < 0)
gdbpy_print_stack ();
@@ -115,7 +115,7 @@ python_inferior_exit (struct inferior *inf)
struct cleanup *cleanup;
const LONGEST *exit_code = NULL;
- cleanup = ensure_python_env (target_gdbarch, current_language);
+ cleanup = ensure_python_env (target_gdbarch (), current_language);
if (inf->has_exit_code)
exit_code = &inf->exit_code;
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 97f8506..cd50e50 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1280,7 +1280,7 @@ finalize_python (void *ignore)
clearer to make the needed calls explicitly here than to create a
cleanup and then mysteriously discard it. */
PyGILState_Ensure ();
- python_gdbarch = target_gdbarch;
+ python_gdbarch = target_gdbarch ();
python_language = current_language;
Py_Finalize ();
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 0c475cb..0f9380b 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -166,7 +166,7 @@ get_running_thread_id (void)
char *buf;
CORE_ADDR object_addr;
struct type *builtin_type_void_data_ptr =
- builtin_type (target_gdbarch)->builtin_data_ptr;
+ builtin_type (target_gdbarch ())->builtin_data_ptr;
if (!object_msym)
return 0;
diff --git a/gdb/record.c b/gdb/record.c
index c98ed32..08ffb68 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -512,14 +512,14 @@ record_arch_list_add_mem (CORE_ADDR addr, int len)
fprintf_unfiltered (gdb_stdlog,
"Process record: add mem addr = %s len = %d to "
"record list.\n",
- paddress (target_gdbarch, addr), len);
+ paddress (target_gdbarch (), addr), len);
if (!addr) /* FIXME: Why? Some arch must permit it... */
return 0;
rec = record_mem_alloc (addr, len);
- if (record_read_memory (target_gdbarch, addr, record_get_loc (rec), len))
+ if (record_read_memory (target_gdbarch (), addr, record_get_loc (rec), len))
{
record_mem_release (rec);
return -1;
@@ -874,7 +874,7 @@ record_open_1 (char *name, int from_tty)
error (_("Process record target can't debug inferior in non-stop mode "
"(non-stop)."));
- if (!gdbarch_process_record_p (target_gdbarch))
+ if (!gdbarch_process_record_p (target_gdbarch ()))
error (_("Process record: the current architecture doesn't support "
"record function."));
@@ -1686,7 +1686,7 @@ record_xfer_partial (struct target_ops *ops, enum target_object object,
if (!query (_("Because GDB is in replay mode, writing to memory "
"will make the execution log unusable from this "
"point onward. Write memory at address %s?"),
- paddress (target_gdbarch, offset)))
+ paddress (target_gdbarch (), offset)))
error (_("Process record canceled the operation."));
/* Destroy the record from here forward. */
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 748aeba..f7addea 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -487,7 +487,7 @@ m32r_resume (struct target_ops *ops,
else
{
buf[0] = SDI_WRITE_MEMORY;
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
store_long_parameter (buf + 1, pc_addr);
else
store_long_parameter (buf + 1, pc_addr - 1);
@@ -527,7 +527,7 @@ m32r_resume (struct target_ops *ops,
continue;
/* Set PBP. */
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8000 + 4 * i, 4,
0x00000006);
else
@@ -554,7 +554,7 @@ m32r_resume (struct target_ops *ops,
store_long_parameter (buf + 5, 4);
if ((bp_addr & 2) == 0 && bp_addr != (pc_addr & 0xfffffffc))
{
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
{
buf[9] = dbt_bp_entry[0];
buf[10] = dbt_bp_entry[1];
@@ -571,7 +571,7 @@ m32r_resume (struct target_ops *ops,
}
else
{
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
{
if ((bp_addr & 2) == 0)
{
@@ -618,7 +618,7 @@ m32r_resume (struct target_ops *ops,
continue;
/* DBC register. */
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
{
switch (ab_type[i])
{
@@ -760,7 +760,7 @@ m32r_wait (struct target_ops *ops,
if (last_pc_addr != 0xffffffff)
{
buf[0] = SDI_WRITE_MEMORY;
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
store_long_parameter (buf + 1, last_pc_addr);
else
store_long_parameter (buf + 1, last_pc_addr - 1);
@@ -789,7 +789,7 @@ m32r_wait (struct target_ops *ops,
address, we have to take care of it later. */
if ((pc_addr & 0x2) != 0)
{
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
{
if ((bp_data[i][2] & 0x80) != 0)
{
@@ -851,7 +851,7 @@ m32r_wait (struct target_ops *ops,
c = serial_readchar (sdi_desc, SDI_TIMEOUT);
if (c != '-' && recv_data (buf, 4) != -1)
{
- if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG)
+ if (gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG)
{
if ((buf[3] & 0x1) == 0x1)
hit_watchpoint_addr = ab_address[i];
@@ -1055,10 +1055,10 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
{
if (write)
fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,write)\n",
- paddress (target_gdbarch, memaddr), len);
+ paddress (target_gdbarch (), memaddr), len);
else
fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,read)\n",
- paddress (target_gdbarch, memaddr), len);
+ paddress (target_gdbarch (), memaddr), len);
}
if (write)
@@ -1424,7 +1424,7 @@ m32r_insert_watchpoint (CORE_ADDR addr, int len, int type,
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n",
- paddress (target_gdbarch, addr), len, type);
+ paddress (target_gdbarch (), addr), len, type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
@@ -1449,7 +1449,7 @@ m32r_remove_watchpoint (CORE_ADDR addr, int len, int type,
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n",
- paddress (target_gdbarch, addr), len, type);
+ paddress (target_gdbarch (), addr), len, type);
for (i = 0; i < MAX_ACCESS_BREAKS; i++)
{
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index eee2460..ff5806e 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1242,7 +1242,7 @@ mips_request (int cmd,
int timeout,
char *buff)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
char myBuff[DATA_MAXLEN + 1];
char response_string[17];
int len;
@@ -1663,10 +1663,10 @@ static void
mips_open (char *name, int from_tty)
{
const char *monitor_prompt = NULL;
- if (gdbarch_bfd_arch_info (target_gdbarch) != NULL
- && gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_mips)
+ if (gdbarch_bfd_arch_info (target_gdbarch ()) != NULL
+ && gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_mips)
{
- switch (gdbarch_bfd_arch_info (target_gdbarch)->mach)
+ switch (gdbarch_bfd_arch_info (target_gdbarch ())->mach)
{
case bfd_mach_mips4100:
case bfd_mach_mips4300:
@@ -2147,7 +2147,7 @@ static int
mips_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
struct mem_attrib *attrib, struct target_ops *target)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int i;
CORE_ADDR addr;
int count;
@@ -2479,7 +2479,7 @@ static int
mips_check_lsi_error (CORE_ADDR addr, int rerrflg)
{
struct lsi_error *err;
- const char *saddr = paddress (target_gdbarch, addr);
+ const char *saddr = paddress (target_gdbarch (), addr);
if (rerrflg == 0) /* no error */
return 0;
@@ -2547,13 +2547,13 @@ mips_common_breakpoint (%s): Unknown error: 0x%x\n",
static int
mips_common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
char buf[DATA_MAXLEN + 1];
char cmd, rcmd;
int rpid, rerrflg, rresponse, rlen;
int nfields;
- addr = gdbarch_addr_bits_remove (target_gdbarch, addr);
+ addr = gdbarch_addr_bits_remove (target_gdbarch (), addr);
if (mips_monitor == MON_LSI)
{
@@ -2581,7 +2581,7 @@ mips_common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type)
{
warning (_("\
mips_common_breakpoint: Attempt to clear bogus breakpoint at %s"),
- paddress (target_gdbarch, addr));
+ paddress (target_gdbarch (), addr));
return 1;
}
@@ -2732,7 +2732,7 @@ mips_common_breakpoint: Attempt to clear bogus breakpoint at %s"),
if (rresponse != 22) /* invalid argument */
fprintf_unfiltered (gdb_stderr, "\
mips_common_breakpoint (%s): Got error: 0x%x\n",
- paddress (target_gdbarch, addr), rresponse);
+ paddress (target_gdbarch (), addr), rresponse);
return 1;
}
}
@@ -2765,7 +2765,7 @@ send_srec (char *srec, int len, CORE_ADDR addr)
case 0x15: /* NACK */
fprintf_unfiltered (gdb_stderr,
"Download got a NACK at byte %s! Retrying.\n",
- paddress (target_gdbarch, addr));
+ paddress (target_gdbarch (), addr));
continue;
default:
error (_("Download got unexpected ack char: 0x%x, retrying."),
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index adc77e7..e2738a8 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1098,7 +1098,7 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
gdb_print_host_address (myaddr, gdb_stdout);
printf_filtered (", memaddr %s, len %d, write %d\n",
- paddress (target_gdbarch, memaddr), len, write);
+ paddress (target_gdbarch (), memaddr), len, write);
if (remote_debug && write)
dump_mem (myaddr, len);
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 24bb9bc..be77ad1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -397,9 +397,9 @@ struct packet_reg
long regnum; /* GDB's internal register number. */
LONGEST pnum; /* Remote protocol register number. */
int in_g_packet; /* Always part of G packet. */
- /* long size in bytes; == register_size (target_gdbarch, regnum);
+ /* long size in bytes; == register_size (target_gdbarch (), regnum);
at present. */
- /* char *name; == gdbarch_register_name (target_gdbarch, regnum);
+ /* char *name; == gdbarch_register_name (target_gdbarch (), regnum);
at present. */
};
@@ -484,7 +484,7 @@ remote_get_noisy_reply (char **buf_p,
TRY_CATCH (ex, RETURN_MASK_ALL)
{
- gdbarch_relocate_instruction (target_gdbarch, &to, from);
+ gdbarch_relocate_instruction (target_gdbarch (), &to, from);
}
if (ex.reason >= 0)
{
@@ -525,7 +525,7 @@ static struct gdbarch_data *remote_gdbarch_data_handle;
static struct remote_arch_state *
get_remote_arch_state (void)
{
- return gdbarch_data (target_gdbarch, remote_gdbarch_data_handle);
+ return gdbarch_data (target_gdbarch (), remote_gdbarch_data_handle);
}
/* Fetch the global remote target state. */
@@ -698,7 +698,7 @@ get_remote_packet_size (void)
static struct packet_reg *
packet_reg_from_regnum (struct remote_arch_state *rsa, long regnum)
{
- if (regnum < 0 && regnum >= gdbarch_num_regs (target_gdbarch))
+ if (regnum < 0 && regnum >= gdbarch_num_regs (target_gdbarch ()))
return NULL;
else
{
@@ -714,7 +714,7 @@ packet_reg_from_pnum (struct remote_arch_state *rsa, LONGEST pnum)
{
int i;
- for (i = 0; i < gdbarch_num_regs (target_gdbarch); i++)
+ for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++)
{
struct packet_reg *r = &rsa->regs[i];
@@ -1481,7 +1481,7 @@ remote_add_inferior (int fake_pid_p, int pid, int attached)
if (attached == -1)
attached = remote_query_attached (pid);
- if (gdbarch_has_global_solist (target_gdbarch))
+ if (gdbarch_has_global_solist (target_gdbarch ()))
{
/* If the target shares code across all inferiors, then every
attach adds a new inferior. */
@@ -3338,7 +3338,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* On OSs where the list of libraries is global to all
processes, we fetch them early. */
- if (gdbarch_has_global_solist (target_gdbarch))
+ if (gdbarch_has_global_solist (target_gdbarch ()))
solib_add (NULL, from_tty, target, auto_solib_add);
if (non_stop)
@@ -3420,7 +3420,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
supported for non-stop; it could be, but it is tricky if
there are no stopped threads when we connect. */
if (remote_read_description_p (target)
- && gdbarch_target_desc (target_gdbarch) == NULL)
+ && gdbarch_target_desc (target_gdbarch ()) == NULL)
{
target_clear_description ();
target_find_description ();
@@ -3539,7 +3539,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
rs->starting_up = 0;
/* If breakpoints are global, insert them now. */
- if (gdbarch_has_global_breakpoints (target_gdbarch)
+ if (gdbarch_has_global_breakpoints (target_gdbarch ())
&& breakpoints_always_inserted_mode ())
insert_breakpoints ();
}
@@ -3619,12 +3619,12 @@ remote_check_symbols (struct objfile *objfile)
xsnprintf (msg, get_remote_packet_size (), "qSymbol::%s", &reply[8]);
else
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
CORE_ADDR sym_addr = SYMBOL_VALUE_ADDRESS (sym);
/* If this is a function address, return the start of code
instead of any data function descriptor. */
- sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
¤t_target);
@@ -5407,10 +5407,10 @@ Packet: '%s'\n"),
cached_reg.num = reg->regnum;
fieldsize = hex2bin (p, cached_reg.data,
- register_size (target_gdbarch,
+ register_size (target_gdbarch (),
reg->regnum));
p += 2 * fieldsize;
- if (fieldsize < register_size (target_gdbarch,
+ if (fieldsize < register_size (target_gdbarch (),
reg->regnum))
warning (_("Remote reply is too short: %s"), buf);
@@ -5604,7 +5604,7 @@ process_stop_reply (struct stop_reply *stop_reply,
if (stop_reply->regcache)
{
struct regcache *regcache
- = get_thread_arch_regcache (ptid, target_gdbarch);
+ = get_thread_arch_regcache (ptid, target_gdbarch ());
cached_reg_t *reg;
int ix;
@@ -6318,7 +6318,7 @@ remote_address_masked (CORE_ADDR addr)
/* If "remoteaddresssize" was not set, default to target address size. */
if (!address_size)
- address_size = gdbarch_addr_bit (target_gdbarch);
+ address_size = gdbarch_addr_bit (target_gdbarch ());
if (address_size > 0
&& address_size < (sizeof (ULONGEST) * 8))
@@ -6854,7 +6854,7 @@ static void
remote_flash_erase (struct target_ops *ops,
ULONGEST address, LONGEST length)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
int saved_remote_timeout = remote_timeout;
enum packet_result ret;
struct cleanup *back_to = make_cleanup (restore_remote_timeout,
@@ -8378,12 +8378,12 @@ compare_sections_command (char *args, int from_tty)
if (res == -1)
error (_("target memory fault, section %s, range %s -- %s"), sectname,
- paddress (target_gdbarch, lma),
- paddress (target_gdbarch, lma + size));
+ paddress (target_gdbarch (), lma),
+ paddress (target_gdbarch (), lma + size));
printf_filtered ("Section %s, range %s -- %s: ", sectname,
- paddress (target_gdbarch, lma),
- paddress (target_gdbarch, lma + size));
+ paddress (target_gdbarch (), lma),
+ paddress (target_gdbarch (), lma + size));
if (res)
printf_filtered ("matched.\n");
else
@@ -8739,7 +8739,7 @@ remote_search_memory (struct target_ops* ops,
const gdb_byte *pattern, ULONGEST pattern_len,
CORE_ADDR *found_addrp)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
struct remote_state *rs = get_remote_state ();
int max_size = get_memory_write_packet_size ();
struct packet_config *packet =
@@ -9273,7 +9273,7 @@ static int
remote_read_description_p (struct target_ops *target)
{
struct remote_g_packet_data *data
- = gdbarch_data (target_gdbarch, remote_g_packet_data_handle);
+ = gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
return 1;
@@ -9285,7 +9285,7 @@ static const struct target_desc *
remote_read_description (struct target_ops *target)
{
struct remote_g_packet_data *data
- = gdbarch_data (target_gdbarch, remote_g_packet_data_handle);
+ = gdbarch_data (target_gdbarch (), remote_g_packet_data_handle);
/* Do not try this during initial connection, when we do not know
whether there is a running but stopped thread. */
@@ -10279,7 +10279,7 @@ remote_download_tracepoint (struct bp_location *loc)
{
int isize;
- if (gdbarch_fast_tracepoint_valid_at (target_gdbarch,
+ if (gdbarch_fast_tracepoint_valid_at (target_gdbarch (),
tpaddr, &isize, NULL))
xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
isize);
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index acd36c2..2323276 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -616,7 +616,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size,
if (value.kind == pvk_register
&& value.k == 0
&& pv_is_register (addr, RL78_SP_REGNUM)
- && size == register_size (target_gdbarch, value.reg))
+ && size == register_size (target_gdbarch (), value.reg))
result->reg_offset[value.reg] = addr.k;
}
@@ -643,7 +643,7 @@ rl78_analyze_prologue (CORE_ADDR start_pc,
result->reg_offset[rn] = 1;
}
- stack = make_pv_area (RL78_SP_REGNUM, gdbarch_addr_bit (target_gdbarch));
+ stack = make_pv_area (RL78_SP_REGNUM, gdbarch_addr_bit (target_gdbarch ()));
back_to = make_cleanup_free_pv_area (stack);
/* The call instruction has saved the return address on the stack. */
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 2d2df5b..f46169b 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -76,7 +76,7 @@
#ifndef ARCH3264
# define ARCH64() 0
#else
-# define ARCH64() (register_size (target_gdbarch, 0) == 8)
+# define ARCH64() (register_size (target_gdbarch (), 0) == 8)
#endif
/* Union of 32-bit and 64-bit versions of ld_info. */
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 8637c0c..5990126 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -154,7 +154,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
if (value.kind == pvk_register
&& value.k == 0
&& pv_is_register (addr, RX_SP_REGNUM)
- && size == register_size (target_gdbarch, value.reg))
+ && size == register_size (target_gdbarch (), value.reg))
result->reg_offset[value.reg] = addr.k;
}
@@ -207,7 +207,7 @@ rx_analyze_prologue (CORE_ADDR start_pc,
result->reg_offset[rn] = 1;
}
- stack = make_pv_area (RX_SP_REGNUM, gdbarch_addr_bit (target_gdbarch));
+ stack = make_pv_area (RX_SP_REGNUM, gdbarch_addr_bit (target_gdbarch ()));
back_to = make_cleanup_free_pv_area (stack);
/* The call instruction has saved the return address on the stack. */
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index bad1b43..ff68676 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -601,7 +601,7 @@ s390_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
int sizeof_auxv_field = s390_target_wordsize ();
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte *ptr = *readptr;
if (endptr == ptr)
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index bd31f4f..b2c1806 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -861,7 +861,7 @@ ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
@@ -883,7 +883,7 @@ ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
@@ -917,7 +917,7 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
@@ -939,7 +939,7 @@ ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
old_chain = save_inferior_ptid ();
inferior_ptid = BUILD_LWP (lwpid, PIDGET (inferior_ptid));
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
@@ -1119,7 +1119,7 @@ info_cb (const td_thrhandle_t *th, void *s)
SYMBOL_PRINT_NAME (msym));
else
printf_filtered (" startfunc: %s\n",
- paddress (target_gdbarch, ti.ti_startfunc));
+ paddress (target_gdbarch (), ti.ti_startfunc));
}
/* If thread is asleep, print function that went to sleep. */
@@ -1132,7 +1132,7 @@ info_cb (const td_thrhandle_t *th, void *s)
SYMBOL_PRINT_NAME (msym));
else
printf_filtered (" - Sleep func: %s\n",
- paddress (target_gdbarch, ti.ti_startfunc));
+ paddress (target_gdbarch (), ti.ti_startfunc));
}
/* Wrap up line, if necessary. */
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 55ecb91..4ea0722 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -127,8 +127,8 @@ static void
darwin_load_image_infos (struct darwin_info *info)
{
gdb_byte buf[24];
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int len;
/* If the structure address is not known, don't continue. */
@@ -245,8 +245,8 @@ open_symbol_file_object (void *from_ttyp)
static struct so_list *
darwin_current_sos (void)
{
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int ptr_len = TYPE_LENGTH (ptr_type);
unsigned int image_info_size;
struct so_list *head = NULL;
@@ -378,7 +378,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
make_cleanup_bfd_unref (dyld_bfd);
sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object,
- gdbarch_bfd_arch_info (target_gdbarch));
+ gdbarch_bfd_arch_info (target_gdbarch ()));
if (sub)
{
dyld_bfd = sub;
@@ -420,7 +420,7 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info)
{
gdb_byte buf[8 + 8 + 4];
LONGEST len;
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
len = target_read (¤t_target, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL,
buf, 0, sizeof (buf));
@@ -450,7 +450,7 @@ darwin_solib_create_inferior_hook (int from_tty)
darwin_load_image_infos (info);
if (darwin_dyld_version_ok (info))
- create_solib_event_breakpoint (target_gdbarch, info->all_image.notifier);
+ create_solib_event_breakpoint (target_gdbarch (), info->all_image.notifier);
}
static void
@@ -515,7 +515,7 @@ darwin_bfd_open (char *pathname)
abfd = solib_bfd_fopen (found_pathname, found_file);
res = bfd_mach_o_fat_extract (abfd, bfd_object,
- gdbarch_bfd_arch_info (target_gdbarch));
+ gdbarch_bfd_arch_info (target_gdbarch ()));
if (!res)
{
make_cleanup_bfd_unref (abfd);
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 8276db2..9024be2 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -212,13 +212,13 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map)
for (i = 0; i < map->nsegs; i++)
printf_filtered ("%s:%s -> %s:%s\n",
- print_core_address (target_gdbarch,
+ print_core_address (target_gdbarch (),
map->segs[i].p_vaddr),
- print_core_address (target_gdbarch,
+ print_core_address (target_gdbarch (),
map->segs[i].p_vaddr
+ map->segs[i].p_memsz),
- print_core_address (target_gdbarch, map->segs[i].addr),
- print_core_address (target_gdbarch, map->segs[i].addr
+ print_core_address (target_gdbarch (), map->segs[i].addr),
+ print_core_address (target_gdbarch (), map->segs[i].addr
+ map->segs[i].p_memsz));
}
}
@@ -228,7 +228,7 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map)
static struct int_elf32_dsbt_loadmap *
decode_loadmap (gdb_byte *buf)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct ext_elf32_dsbt_loadmap *ext_ldmbuf;
struct int_elf32_dsbt_loadmap *int_ldmbuf;
@@ -327,7 +327,7 @@ dsbt_get_initial_loadmaps (void)
static struct int_elf32_dsbt_loadmap *
fetch_loadmap (CORE_ADDR ldmaddr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct ext_elf32_dsbt_loadmap ext_ldmbuf_partial;
struct ext_elf32_dsbt_loadmap *ext_ldmbuf;
struct int_elf32_dsbt_loadmap *int_ldmbuf;
@@ -496,7 +496,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
gdb_byte ptr_buf[8];
CORE_ADDR ptr_addr;
- ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
@@ -555,7 +555,7 @@ displacement_from_map (struct int_elf32_dsbt_loadmap *map,
static CORE_ADDR
lm_base (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct minimal_symbol *got_sym;
CORE_ADDR addr;
gdb_byte buf[TIC6X_PTR_SIZE];
@@ -635,7 +635,7 @@ lm_base (void)
static struct so_list *
dsbt_current_sos (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR lm_addr;
struct so_list *sos_head = NULL;
struct so_list **sos_next_ptr = &sos_head;
@@ -814,7 +814,7 @@ cmp_name (asymbol *sym, void *data)
static int
enable_break2 (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int success = 0;
char **bkpt_namep;
asection *interp_sect;
@@ -965,7 +965,7 @@ enable_break2 (void)
remove_solib_event_breakpoints ();
/* Now (finally!) create the solib breakpoint. */
- create_solib_event_breakpoint (target_gdbarch, addr);
+ create_solib_event_breakpoint (target_gdbarch (), addr);
info->enable_break2_done = 1;
@@ -1007,7 +1007,7 @@ enable_break (void)
return 0;
}
- create_solib_event_breakpoint (target_gdbarch,
+ create_solib_event_breakpoint (target_gdbarch (),
SYMBOL_VALUE_ADDRESS (start));
if (solib_dsbt_debug)
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 57a14a8..d259440 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -98,7 +98,7 @@ struct int_elf32_fdpic_loadmap {
static struct int_elf32_fdpic_loadmap *
fetch_loadmap (CORE_ADDR ldmaddr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct ext_elf32_fdpic_loadmap ext_ldmbuf_partial;
struct ext_elf32_fdpic_loadmap *ext_ldmbuf;
struct int_elf32_fdpic_loadmap *int_ldmbuf;
@@ -265,7 +265,7 @@ static CORE_ADDR main_lm_addr = 0;
static CORE_ADDR
lm_base (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct minimal_symbol *got_sym;
CORE_ADDR addr;
gdb_byte buf[FRV_PTR_SIZE];
@@ -317,7 +317,7 @@ lm_base (void)
static struct so_list *
frv_current_sos (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR lm_addr, mgot;
struct so_list *sos_head = NULL;
struct so_list **sos_next_ptr = &sos_head;
@@ -518,7 +518,7 @@ static int enable_break2_done = 0;
static int
enable_break2 (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int success = 0;
char **bkpt_namep;
asection *interp_sect;
@@ -569,7 +569,7 @@ enable_break2 (void)
return 0;
}
- status = frv_fdpic_loadmap_addresses (target_gdbarch,
+ status = frv_fdpic_loadmap_addresses (target_gdbarch (),
&interp_loadmap_addr, 0);
if (status < 0)
{
@@ -703,7 +703,7 @@ enable_break2 (void)
remove_solib_event_breakpoints ();
/* Now (finally!) create the solib breakpoint. */
- create_solib_event_breakpoint (target_gdbarch, addr);
+ create_solib_event_breakpoint (target_gdbarch (), addr);
enable_break2_done = 1;
@@ -751,7 +751,7 @@ enable_break (void)
return 0;
}
- create_solib_event_breakpoint (target_gdbarch,
+ create_solib_event_breakpoint (target_gdbarch (),
symfile_objfile->ei.entry_point);
if (solib_frv_debug)
@@ -782,7 +782,7 @@ frv_relocate_main_executable (void)
int changed;
struct obj_section *osect;
- status = frv_fdpic_loadmap_addresses (target_gdbarch,
+ status = frv_fdpic_loadmap_addresses (target_gdbarch (),
&interp_addr, &exec_addr);
if (status < 0 || (exec_addr == 0 && interp_addr == 0))
@@ -1021,7 +1021,7 @@ find_canonical_descriptor_in_load_object
(CORE_ADDR entry_point, CORE_ADDR got_value, const char *name, bfd *abfd,
struct lm_info *lm)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
arelent *rel;
unsigned int i;
CORE_ADDR addr = 0;
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index f349c4c..0d2b835 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -396,7 +396,7 @@ ia64_hpux_clear_solib (void)
static CORE_ADDR
ia64_hpux_get_load_info_addr (void)
{
- struct type *data_ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *data_ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
CORE_ADDR addr;
int status;
diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
index 1cec282..52378e9 100644
--- a/gdb/solib-irix.c
+++ b/gdb/solib-irix.c
@@ -142,7 +142,7 @@ extract_mips_address (void *addr, int len, enum bfd_endian byte_order)
static struct lm_info
fetch_lm_info (CORE_ADDR addr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct lm_info li;
union irix_obj_info buf;
@@ -306,7 +306,7 @@ disable_break (void)
/* Note that breakpoint address and original contents are in our address
space, so we just need to write the original contents back. */
- if (deprecated_remove_raw_breakpoint (target_gdbarch, base_breakpoint) != 0)
+ if (deprecated_remove_raw_breakpoint (target_gdbarch (), base_breakpoint) != 0)
{
status = 0;
}
@@ -339,7 +339,7 @@ enable_break (void)
if (!entry_point_address_query (&entry_point))
return 0;
- base_breakpoint = deprecated_insert_raw_breakpoint (target_gdbarch,
+ base_breakpoint = deprecated_insert_raw_breakpoint (target_gdbarch (),
aspace, entry_point);
if (base_breakpoint != NULL)
@@ -453,8 +453,8 @@ irix_solib_create_inferior_hook (int from_tty)
static struct so_list *
irix_current_sos (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
- int addr_size = gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT;
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / TARGET_CHAR_BIT;
CORE_ADDR lma;
char addr_buf[8];
struct so_list *head = 0;
@@ -545,8 +545,8 @@ irix_current_sos (void)
static int
irix_open_symbol_file_object (void *from_ttyp)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
- int addr_size = gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT;
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / TARGET_CHAR_BIT;
CORE_ADDR lma;
char addr_buf[8];
struct lm_info lm;
diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index 60b3684..c37b617 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -391,7 +391,7 @@ manpage for methods to privately map shared library text."));
/* Create the shared library breakpoint. */
{
struct breakpoint *b
- = create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ = create_solib_event_breakpoint (target_gdbarch (), sym_addr);
/* The breakpoint is actually hard-coded into the dynamic linker,
so we don't need to actually insert a breakpoint instruction
diff --git a/gdb/solib-som.c b/gdb/solib-som.c
index 6fea108..47bf5a3 100644
--- a/gdb/solib-som.c
+++ b/gdb/solib-som.c
@@ -185,7 +185,7 @@ struct {
static void
som_solib_create_inferior_hook (int from_tty)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct minimal_symbol *msymbol;
unsigned int dld_flags, status, have_endo;
asection *shlib_info;
@@ -288,7 +288,7 @@ Suggest linking with /opt/langtools/lib/end.o.\n\
GDB will be unable to track shl_load/shl_unload calls"));
goto keep_going;
}
- create_solib_event_breakpoint (target_gdbarch,
+ create_solib_event_breakpoint (target_gdbarch (),
SYMBOL_VALUE_ADDRESS (msymbol));
/* We have all the support usually found in end.o, so we can track
@@ -353,7 +353,7 @@ manpage for methods to privately map shared library text."));
anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
/* Make the breakpoint at "_start" a shared library event breakpoint. */
- create_solib_event_breakpoint (target_gdbarch, anaddr);
+ create_solib_event_breakpoint (target_gdbarch (), anaddr);
clear_symtab_users (0);
}
@@ -525,7 +525,7 @@ struct dld_list {
static CORE_ADDR
link_map_start (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct minimal_symbol *sym;
CORE_ADDR addr;
char buf[4];
@@ -575,7 +575,7 @@ match_main (const char *name)
static struct so_list *
som_current_sos (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR lm;
struct so_list *head = 0;
struct so_list **link_ptr = &head;
@@ -642,27 +642,27 @@ som_current_sos (void)
#ifdef SOLIB_SOM_DBG
printf ("\n+ library \"%s\" is described at %s\n", new->so_name,
- paddress (target_gdbarch, lm));
+ paddress (target_gdbarch (), lm));
printf (" 'version' is %d\n", new->lm_info->struct_version);
printf (" 'bind_mode' is %d\n", new->lm_info->bind_mode);
printf (" 'library_version' is %d\n",
new->lm_info->library_version);
printf (" 'text_addr' is %s\n",
- paddress (target_gdbarch, new->lm_info->text_addr));
+ paddress (target_gdbarch (), new->lm_info->text_addr));
printf (" 'text_link_addr' is %s\n",
- paddress (target_gdbarch, new->lm_info->text_link_addr));
+ paddress (target_gdbarch (), new->lm_info->text_link_addr));
printf (" 'text_end' is %s\n",
- paddress (target_gdbarch, new->lm_info->text_end));
+ paddress (target_gdbarch (), new->lm_info->text_end));
printf (" 'data_start' is %s\n",
- paddress (target_gdbarch, new->lm_info->data_start));
+ paddress (target_gdbarch (), new->lm_info->data_start));
printf (" 'bss_start' is %s\n",
- paddress (target_gdbarch, new->lm_info->bss_start));
+ paddress (target_gdbarch (), new->lm_info->bss_start));
printf (" 'data_end' is %s\n",
- paddress (target_gdbarch, new->lm_info->data_end));
+ paddress (target_gdbarch (), new->lm_info->data_end));
printf (" 'got_value' is %s\n",
- paddress (target_gdbarch, new->lm_info->got_value));
+ paddress (target_gdbarch (), new->lm_info->got_value));
printf (" 'tsd_start_addr' is %s\n",
- paddress (target_gdbarch, new->lm_info->tsd_start_addr));
+ paddress (target_gdbarch (), new->lm_info->tsd_start_addr));
#endif
new->addr_low = lmi->text_addr;
@@ -692,7 +692,7 @@ som_current_sos (void)
static int
som_open_symbol_file_object (void *from_ttyp)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR lm, l_name;
char *filename;
int errcode;
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index f62d96c..09a4047 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -158,7 +158,7 @@ append_ocl_sos (struct so_list **link_ptr)
static struct so_list *
spu_current_sos (void)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct so_list *head;
struct so_list **link_ptr;
@@ -418,9 +418,9 @@ spu_enable_break (struct objfile *objfile)
{
CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (spe_event_sym);
- addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, addr,
+ addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr,
¤t_target);
- create_solib_event_breakpoint (target_gdbarch, addr);
+ create_solib_event_breakpoint (target_gdbarch (), addr);
return 1;
}
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index b17ef8a..b8b3806 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -121,7 +121,7 @@ static char *main_name_list[] =
#define SOLIB_EXTRACT_ADDRESS(MEMBER) \
extract_unsigned_integer (&(MEMBER), sizeof (MEMBER), \
- gdbarch_byte_order (target_gdbarch))
+ gdbarch_byte_order (target_gdbarch ()))
/* local data declarations */
@@ -141,7 +141,7 @@ static CORE_ADDR flag_addr;
static CORE_ADDR
lm_addr (struct so_list *so)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int lm_addr_offset = offsetof (struct link_map, lm_addr);
int lm_addr_size = fieldsize (struct link_map, lm_addr);
@@ -152,7 +152,7 @@ lm_addr (struct so_list *so)
static CORE_ADDR
lm_next (struct so_list *so)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int lm_next_offset = offsetof (struct link_map, lm_next);
int lm_next_size = fieldsize (struct link_map, lm_next);
@@ -164,7 +164,7 @@ lm_next (struct so_list *so)
static CORE_ADDR
lm_name (struct so_list *so)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int lm_name_offset = offsetof (struct link_map, lm_name);
int lm_name_size = fieldsize (struct link_map, lm_name);
@@ -690,9 +690,9 @@ sunos_solib_create_inferior_hook (int from_tty)
the GDB software break point list. Thus we have to adjust the
PC here. */
- if (gdbarch_decr_pc_after_break (target_gdbarch))
+ if (gdbarch_decr_pc_after_break (target_gdbarch ()))
{
- stop_pc -= gdbarch_decr_pc_after_break (target_gdbarch);
+ stop_pc -= gdbarch_decr_pc_after_break (target_gdbarch ());
regcache_write_pc (get_current_regcache (), stop_pc);
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 3d60aa1..37cc654 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -155,12 +155,12 @@ lm_info_read (CORE_ADDR lm_addr)
if (target_read_memory (lm_addr, lm, lmo->link_map_size) != 0)
{
warning (_("Error reading shared library list entry at %s"),
- paddress (target_gdbarch, lm_addr)),
+ paddress (target_gdbarch (), lm_addr)),
lm_info = NULL;
}
else
{
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
lm_info = xzalloc (sizeof (*lm_info));
lm_info->lm_addr = lm_addr;
@@ -264,7 +264,7 @@ lm_addr_check (struct so_list *so, bfd *abfd)
if (info_verbose)
printf_unfiltered (_("Using PIC (Position Independent Code) "
"prelink displacement %s for \"%s\".\n"),
- paddress (target_gdbarch, l_addr),
+ paddress (target_gdbarch (), l_addr),
so->so_name);
}
else
@@ -363,7 +363,7 @@ static int match_main (const char *);
static gdb_byte *
read_program_header (int type, int *p_sect_size, int *p_arch_size)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR at_phdr, at_phent, at_phnum, pt_phdr = 0;
int arch_size, sect_size;
CORE_ADDR sect_addr;
@@ -612,7 +612,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
gdb_byte ptr_buf[8];
CORE_ADDR ptr_addr;
- ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
@@ -632,7 +632,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
static int
scan_dyntag_auxv (int dyntag, CORE_ADDR *ptr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
int sect_size, arch_size, step;
long dyn_tag;
CORE_ADDR dyn_ptr;
@@ -709,7 +709,7 @@ elf_locate_base (void)
if (scan_dyntag (DT_MIPS_RLD_MAP, exec_bfd, &dyn_ptr)
|| scan_dyntag_auxv (DT_MIPS_RLD_MAP, &dyn_ptr))
{
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
gdb_byte *pbuf;
int pbuf_size = TYPE_LENGTH (ptr_type);
@@ -787,7 +787,7 @@ static CORE_ADDR
solib_svr4_r_map (struct svr4_info *info)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
CORE_ADDR addr = 0;
volatile struct gdb_exception ex;
@@ -806,7 +806,7 @@ static CORE_ADDR
solib_svr4_r_brk (struct svr4_info *info)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
return read_memory_typed_address (info->debug_base + lmo->r_brk_offset,
ptr_type);
@@ -819,8 +819,8 @@ static CORE_ADDR
solib_svr4_r_ldsomap (struct svr4_info *info)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
ULONGEST version;
/* Check version, and return zero if `struct r_debug' doesn't have
@@ -889,7 +889,7 @@ open_symbol_file_object (void *from_ttyp)
int errcode;
int from_tty = *(int *)from_ttyp;
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int l_name_size = TYPE_LENGTH (ptr_type);
gdb_byte *l_name_buf = xmalloc (l_name_size);
struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
@@ -1197,8 +1197,8 @@ svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr,
if (new->lm_info->l_prev != prev_lm)
{
warning (_("Corrupted shared library list: %s != %s"),
- paddress (target_gdbarch, prev_lm),
- paddress (target_gdbarch, new->lm_info->l_prev));
+ paddress (target_gdbarch (), prev_lm),
+ paddress (target_gdbarch (), new->lm_info->l_prev));
do_cleanups (old_chain);
break;
}
@@ -1396,7 +1396,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
gdbarch_convert_from_func_ptr_addr(). The method
gdbarch_convert_from_func_ptr_addr() is the merely the identify
function for targets which don't use function descriptors. */
- return gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ return gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
bfd_get_start_address (abfd),
targ);
}
@@ -1468,7 +1468,7 @@ enable_break (struct svr4_info *info, int from_tty)
struct obj_section *os;
sym_addr = gdbarch_addr_bits_remove
- (target_gdbarch, gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ (target_gdbarch (), gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
¤t_target));
@@ -1522,7 +1522,7 @@ enable_break (struct svr4_info *info, int from_tty)
+ bfd_section_size (tmp_bfd, interp_sect);
}
- create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ create_solib_event_breakpoint (target_gdbarch (), sym_addr);
return 1;
}
}
@@ -1585,7 +1585,7 @@ enable_break (struct svr4_info *info, int from_tty)
if (!load_addr_found)
if (target_auxv_search (¤t_target, AT_BASE, &load_addr) > 0)
{
- int addr_bit = gdbarch_addr_bit (target_gdbarch);
+ int addr_bit = gdbarch_addr_bit (target_gdbarch ());
/* Ensure LOAD_ADDR has proper sign in its possible upper bits so
that `+ load_addr' will overflow CORE_ADDR width not creating
@@ -1621,7 +1621,7 @@ enable_break (struct svr4_info *info, int from_tty)
if (!load_addr_found)
{
struct regcache *regcache
- = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
load_addr = (regcache_read_pc (regcache)
- exec_entry_point (tmp_bfd, tmp_bfd_target));
@@ -1669,7 +1669,7 @@ enable_break (struct svr4_info *info, int from_tty)
/* Convert 'sym_addr' from a function pointer to an address.
Because we pass tmp_bfd_target instead of the current
target, this will always produce an unrelocated value. */
- sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
tmp_bfd_target);
@@ -1680,7 +1680,7 @@ enable_break (struct svr4_info *info, int from_tty)
if (sym_addr != 0)
{
- create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
+ create_solib_event_breakpoint (target_gdbarch (), load_addr + sym_addr);
xfree (interp_name);
return 1;
}
@@ -1703,10 +1703,10 @@ enable_break (struct svr4_info *info, int from_tty)
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
{
sym_addr = SYMBOL_VALUE_ADDRESS (msymbol);
- sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
¤t_target);
- create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ create_solib_event_breakpoint (target_gdbarch (), sym_addr);
return 1;
}
}
@@ -1719,10 +1719,10 @@ enable_break (struct svr4_info *info, int from_tty)
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
{
sym_addr = SYMBOL_VALUE_ADDRESS (msymbol);
- sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
¤t_target);
- create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ create_solib_event_breakpoint (target_gdbarch (), sym_addr);
return 1;
}
}
@@ -1863,7 +1863,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
buf2 = read_program_headers_from_bfd (exec_bfd, &phdrs2_size);
if (buf != NULL && buf2 != NULL)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
/* We are dealing with three different addresses. EXEC_BFD
represents current address in on-disk file. target memory content
@@ -2118,7 +2118,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
printf_unfiltered (_("Using PIE (Position Independent Executable) "
"displacement %s for \"%s\".\n"),
- paddress (target_gdbarch, displacement),
+ paddress (target_gdbarch (), displacement),
bfd_get_filename (exec_bfd));
}
@@ -2301,12 +2301,12 @@ svr4_clear_solib (void)
static CORE_ADDR
svr4_truncate_ptr (CORE_ADDR addr)
{
- if (gdbarch_ptr_bit (target_gdbarch) == sizeof (CORE_ADDR) * 8)
+ if (gdbarch_ptr_bit (target_gdbarch ()) == sizeof (CORE_ADDR) * 8)
/* We don't need to truncate anything, and the bit twiddling below
will fail due to overflow problems. */
return addr;
else
- return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch)) - 1);
+ return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch ())) - 1);
}
@@ -2364,7 +2364,7 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
static struct link_map_offsets *
svr4_fetch_link_map_offsets (void)
{
- struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data);
+ struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch (), solib_svr4_data);
gdb_assert (ops->fetch_link_map_offsets);
return ops->fetch_link_map_offsets ();
@@ -2375,7 +2375,7 @@ svr4_fetch_link_map_offsets (void)
static int
svr4_have_link_map_offsets (void)
{
- struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data);
+ struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch (), solib_svr4_data);
return (ops->fetch_link_map_offsets != NULL);
}
diff --git a/gdb/solib.c b/gdb/solib.c
index d795678..db3842a 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -143,12 +143,12 @@ show_solib_search_path (struct ui_file *file, int from_tty,
char *
solib_find (char *in_pathname, int *fd)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
int found_file = -1;
char *temp_pathname = NULL;
int gdb_sysroot_is_empty;
const char *solib_symbols_extension
- = gdbarch_solib_symbols_extension (target_gdbarch);
+ = gdbarch_solib_symbols_extension (target_gdbarch ());
const char *fskind = effective_target_file_system_kind ();
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
char *sysroot = NULL;
@@ -424,7 +424,7 @@ solib_bfd_open (char *pathname)
}
/* Check bfd arch. */
- b = gdbarch_bfd_arch_info (target_gdbarch);
+ b = gdbarch_bfd_arch_info (target_gdbarch ());
if (!b->compatible (b, bfd_get_arch_info (abfd)))
warning (_("`%s': Shared library architecture %s is not compatible "
"with target architecture %s."), bfd_get_filename (abfd),
@@ -448,7 +448,7 @@ solib_bfd_open (char *pathname)
static int
solib_map_sections (struct so_list *so)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
char *filename;
struct target_section *p;
struct cleanup *old_chain;
@@ -549,7 +549,7 @@ free_so_symbols (struct so_list *so)
void
free_so (struct so_list *so)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
free_so_symbols (so);
ops->free_so (so);
@@ -668,7 +668,7 @@ solib_used (const struct so_list *const known)
static void
update_solib_list (int from_tty, struct target_ops *target)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
@@ -930,7 +930,7 @@ solib_add (char *pattern, int from_tty,
if (loaded_any_symbols)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
/* Getting new symbols may change our opinion about what is
frameless. */
@@ -954,7 +954,7 @@ info_sharedlibrary_command (char *pattern, int from_tty)
int addr_width;
int nr_libs;
struct cleanup *table_cleanup;
- struct gdbarch *gdbarch = target_gdbarch;
+ struct gdbarch *gdbarch = target_gdbarch ();
struct ui_out *uiout = current_uiout;
if (pattern)
@@ -1103,7 +1103,7 @@ solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
int
solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
if (ops->keep_data_in_core)
return ops->keep_data_in_core (vaddr, size);
@@ -1116,7 +1116,7 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
void
clear_solib (void)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
/* This function is expected to handle ELF shared libraries. It is
also used on Solaris, which can run either ELF or a.out binaries
@@ -1164,7 +1164,7 @@ clear_solib (void)
void
solib_create_inferior_hook (int from_tty)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
ops->solib_create_inferior_hook (from_tty);
}
@@ -1175,7 +1175,7 @@ solib_create_inferior_hook (int from_tty)
int
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
return ops->in_dynsym_resolve_code (pc);
}
@@ -1277,7 +1277,7 @@ reload_shared_libraries (char *ignored, int from_tty,
reload_shared_libraries_1 (from_tty);
- ops = solib_ops (target_gdbarch);
+ ops = solib_ops (target_gdbarch ());
/* Creating inferior hooks here has two purposes. First, if we reload
shared libraries then the address of solib breakpoint we've computed
@@ -1344,7 +1344,7 @@ solib_global_lookup (const struct objfile *objfile,
const char *name,
const domain_enum domain)
{
- struct target_so_ops *ops = solib_ops (target_gdbarch);
+ struct target_so_ops *ops = solib_ops (target_gdbarch ());
if (ops->lookup_lib_global_symbol != NULL)
return ops->lookup_lib_global_symbol (objfile, name, domain);
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 1932aae..1db97ce 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -206,7 +206,7 @@ store_ppc_memory (ULONGEST memaddr, const gdb_byte *myaddr, int len)
static int
parse_spufs_run (int *fd, ULONGEST *addr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[4];
ULONGEST pc = fetch_ppc_register (32); /* nip */
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index 8d4ef57..5ace7c5 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -57,19 +57,19 @@ static int spu_nr_solib;
static int
parse_spufs_run (ptid_t ptid, int *fd, CORE_ADDR *addr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
struct gdbarch_tdep *tdep;
struct regcache *regcache;
char buf[4];
ULONGEST regval;
/* If we're not on PPU, there's nothing to detect. */
- if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_powerpc)
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_powerpc)
return 0;
/* Get PPU-side registers. */
- regcache = get_thread_arch_regcache (ptid, target_gdbarch);
- tdep = gdbarch_tdep (target_gdbarch);
+ regcache = get_thread_arch_regcache (ptid, target_gdbarch ());
+ tdep = gdbarch_tdep (target_gdbarch ());
/* Fetch instruction preceding current NIP. */
if (target_read_memory (regcache_read_pc (regcache) - 4, buf, 4) != 0)
@@ -113,7 +113,7 @@ spu_thread_architecture (struct target_ops *ops, ptid_t ptid)
if (parse_spufs_run (ptid, &spufs_fd, &spufs_addr))
return spu_gdbarch (spufs_fd);
- return target_gdbarch;
+ return target_gdbarch ();
}
/* Override the to_region_ok_for_hw_watchpoint routine. */
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 8419a5a..85baf3e 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1186,7 +1186,7 @@ spu2ppu_sniffer (const struct frame_unwind *self,
CORE_ADDR base, func, backchain;
gdb_byte buf[4];
- if (gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_spu)
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_spu)
return 0;
base = get_frame_sp (this_frame);
@@ -1217,7 +1217,7 @@ spu2ppu_sniffer (const struct frame_unwind *self,
else
{
struct regcache *regcache;
- regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+ regcache = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
cache->regcache = regcache_dup (regcache);
*this_prologue_cache = cache;
return 1;
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 2e53be0..1b1e456 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -220,7 +220,7 @@ add_vsyscall_page (struct target_ops *target, int from_tty)
args.bfd = bfd;
args.sysinfo_ehdr = sysinfo_ehdr;
args.name = xstrprintf ("system-supplied DSO at %s",
- paddress (target_gdbarch, sysinfo_ehdr));
+ paddress (target_gdbarch (), sysinfo_ehdr));
/* Pass zero for FROM_TTY, because the action of loading the
vsyscall DSO was not triggered by the user, even if the user
typed "run" at the TTY. */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 6cac666..55af541 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1957,7 +1957,7 @@ load_progress (ULONGEST bytes, void *untyped_arg)
this section. */
ui_out_message (current_uiout, 0, "Loading section %s, size %s lma %s\n",
args->section_name, hex_string (args->section_size),
- paddress (target_gdbarch, args->lma));
+ paddress (target_gdbarch (), args->lma));
return;
}
@@ -1975,10 +1975,10 @@ load_progress (ULONGEST bytes, void *untyped_arg)
if (target_read_memory (args->lma, check, bytes) != 0)
error (_("Download verify read failed at %s"),
- paddress (target_gdbarch, args->lma));
+ paddress (target_gdbarch (), args->lma));
if (memcmp (args->buffer, check, bytes) != 0)
error (_("Download verify compare failed at %s"),
- paddress (target_gdbarch, args->lma));
+ paddress (target_gdbarch (), args->lma));
do_cleanups (verify_cleanups);
}
totals->data_count += bytes;
@@ -2133,7 +2133,7 @@ generic_load (char *args, int from_tty)
entry = bfd_get_start_address (loadfile_bfd);
ui_out_text (uiout, "Start address ");
- ui_out_field_fmt (uiout, "address", "%s", paddress (target_gdbarch, entry));
+ ui_out_field_fmt (uiout, "address", "%s", paddress (target_gdbarch (), entry));
ui_out_text (uiout, ", load size ");
ui_out_field_fmt (uiout, "load-size", "%lu", total_progress.data_count);
ui_out_text (uiout, "\n");
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 7e16222..65542a7 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1767,7 +1767,7 @@ lookup_symbol_global (const char *name,
lookup_data.name = name;
lookup_data.domain = domain;
gdbarch_iterate_over_objfiles_in_search_order
- (objfile != NULL ? get_objfile_arch (objfile) : target_gdbarch,
+ (objfile != NULL ? get_objfile_arch (objfile) : target_gdbarch (),
lookup_symbol_global_iterator_cb, &lookup_data, objfile);
return lookup_data.result;
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 468fe42..12593df 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -334,7 +334,7 @@ target_find_description (void)
/* The current architecture should not have any target description
specified. It should have been cleared, e.g. when we
disconnected from the previous target. */
- gdb_assert (gdbarch_target_desc (target_gdbarch) == NULL);
+ gdb_assert (gdbarch_target_desc (target_gdbarch ()) == NULL);
/* First try to fetch an XML description from the user-specified
file. */
@@ -367,7 +367,7 @@ target_find_description (void)
{
struct tdesc_arch_data *data;
- data = gdbarch_data (target_gdbarch, tdesc_data);
+ data = gdbarch_data (target_gdbarch (), tdesc_data);
if (tdesc_has_registers (current_target_desc)
&& data->arch_regs == NULL)
warning (_("Target-supplied registers are not supported "
diff --git a/gdb/target.c b/gdb/target.c
index 62de336..5015e51 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1128,7 +1128,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
}
if (target != NULL
- && gdbarch_fetch_tls_load_module_address_p (target_gdbarch))
+ && gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
{
ptid_t ptid = inferior_ptid;
volatile struct gdb_exception ex;
@@ -1138,7 +1138,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
CORE_ADDR lm_addr;
/* Fetch the load module address for this objfile. */
- lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch,
+ lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch (),
objfile);
/* If it's 0, throw the appropriate exception. */
if (lm_addr == 0)
@@ -2497,7 +2497,7 @@ target_pre_inferior (int from_tty)
/* In some OSs, the shared library list is the same/global/shared
across inferiors. If code is shared between processes, so are
memory regions and features. */
- if (!gdbarch_has_global_solist (target_gdbarch))
+ if (!gdbarch_has_global_solist (target_gdbarch ()))
{
no_shared_libraries (NULL, from_tty);
@@ -2566,7 +2566,7 @@ target_detach (char *args, int from_tty)
{
struct target_ops* t;
- if (gdbarch_has_global_breakpoints (target_gdbarch))
+ if (gdbarch_has_global_breakpoints (target_gdbarch ()))
/* Don't remove global breakpoints here. They're removed on
disconnection from the target. */
;
@@ -3554,7 +3554,7 @@ target_fileio_read_stralloc (const char *filename)
static int
default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
{
- return (len <= gdbarch_ptr_bit (target_gdbarch) / TARGET_CHAR_BIT);
+ return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT);
}
static int
@@ -3568,7 +3568,7 @@ default_watchpoint_addr_within_range (struct target_ops *target,
static struct gdbarch *
default_thread_architecture (struct target_ops *ops, ptid_t ptid)
{
- return target_gdbarch;
+ return target_gdbarch ();
}
static int
@@ -4055,7 +4055,7 @@ target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
if (targetdebug)
fprintf_unfiltered (gdb_stdlog,
"target_verify_memory (%s, %s) = %d\n",
- paddress (target_gdbarch, memaddr),
+ paddress (target_gdbarch (), memaddr),
pulongest (size),
retval);
return retval;
@@ -4169,7 +4169,7 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
fprintf_unfiltered (gdb_stdlog,
"target_xfer_memory (%s, xxx, %d, %s, xxx) = %d",
- paddress (target_gdbarch, memaddr), len,
+ paddress (target_gdbarch (), memaddr), len,
write ? "write" : "read", retval);
if (retval > 0)
diff --git a/gdb/target.h b/gdb/target.h
index 9a8dda8..7907ee1 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -687,9 +687,9 @@ struct target_ops
to_thread_architecture would return SPU, otherwise PPC32 or PPC64).
This is architecture used to perform decr_pc_after_break adjustment,
and also determines the frame architecture of the innermost frame.
- ptrace operations need to operate according to target_gdbarch.
+ ptrace operations need to operate according to target_gdbarch ().
- The default implementation always returns target_gdbarch. */
+ The default implementation always returns target_gdbarch (). */
struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t);
/* Determine current address space of thread PTID.
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 6e55d57..912341a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4206,7 +4206,7 @@ tfile_get_traceframe_address (off_t tframe_offset)
tfile_read ((gdb_byte *) &tpnum, 2);
tpnum = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
gdbarch_byte_order
- (target_gdbarch));
+ (target_gdbarch ()));
tp = get_tracepoint_by_number_on_target (tpnum);
/* FIXME this is a poor heuristic if multiple locations. */
@@ -4250,14 +4250,14 @@ tfile_trace_find (enum trace_find_type type, int num,
tfile_read ((gdb_byte *) &tpnum, 2);
tpnum = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
gdbarch_byte_order
- (target_gdbarch));
+ (target_gdbarch ()));
offset += 2;
if (tpnum == 0)
break;
tfile_read ((gdb_byte *) &data_size, 4);
data_size = (unsigned int) extract_unsigned_integer
((gdb_byte *) &data_size, 4,
- gdbarch_byte_order (target_gdbarch));
+ gdbarch_byte_order (target_gdbarch ()));
offset += 4;
switch (type)
{
@@ -4365,7 +4365,7 @@ traceframe_walk_blocks (walk_blocks_callback_func callback,
mlen = (unsigned short)
extract_unsigned_integer ((gdb_byte *) &mlen, 2,
gdbarch_byte_order
- (target_gdbarch));
+ (target_gdbarch ()));
lseek (trace_fd, mlen, SEEK_CUR);
pos += (8 + 2 + mlen);
break;
@@ -4502,7 +4502,7 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
{
ULONGEST maddr, amt;
unsigned short mlen;
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
tfile_read ((gdb_byte *) &maddr, 8);
maddr = extract_unsigned_integer ((gdb_byte *) &maddr, 8,
@@ -4585,13 +4585,13 @@ tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val)
tfile_read ((gdb_byte *) &vnum, 4);
vnum = (int) extract_signed_integer ((gdb_byte *) &vnum, 4,
gdbarch_byte_order
- (target_gdbarch));
+ (target_gdbarch ()));
if (tsvnum == vnum)
{
tfile_read ((gdb_byte *) val, 8);
*val = extract_signed_integer ((gdb_byte *) val, 8,
gdbarch_byte_order
- (target_gdbarch));
+ (target_gdbarch ()));
return 1;
}
pos += (4 + 8);
@@ -4739,7 +4739,7 @@ parse_static_tracepoint_marker_definition (char *line, char **pp,
p = unpack_varlen_hex (p, &addr);
p++; /* skip a colon */
- marker->gdbarch = target_gdbarch;
+ marker->gdbarch = target_gdbarch ();
marker->address = (CORE_ADDR) addr;
endp = strchr (p, ':');
@@ -4916,7 +4916,7 @@ info_static_tracepoint_markers_command (char *arg, int from_tty)
ui_out_table_header (uiout, 40, ui_left, "marker-id", "ID");
ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb");
- if (gdbarch_addr_bit (target_gdbarch) <= 32)
+ if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
ui_out_table_header (uiout, 10, ui_left, "addr", "Address");
else
ui_out_table_header (uiout, 18, ui_left, "addr", "Address");
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 5eb8f67..a8766cd 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2404,7 +2404,7 @@ windows_xfer_shared_libraries (struct target_ops *ops,
for (so = solib_start.next; so; so = so->next)
windows_xfer_shared_library (so->so_name, (CORE_ADDR)
(uintptr_t) so->lm_info->load_addr,
- target_gdbarch, &obstack);
+ target_gdbarch (), &obstack);
obstack_grow_str0 (&obstack, "</library-list>\n");
buf = obstack_finish (&obstack);
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 116525c..9c89e92 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -290,8 +290,8 @@ display_one_tib (ptid_t ptid)
gdb_byte *index;
CORE_ADDR thread_local_base;
ULONGEST i, val, max, max_name, size, tib_size;
- ULONGEST sizeof_ptr = gdbarch_ptr_bit (target_gdbarch);
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+ ULONGEST sizeof_ptr = gdbarch_ptr_bit (target_gdbarch ());
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
if (sizeof_ptr == 64)
{
@@ -329,13 +329,13 @@ display_one_tib (ptid_t ptid)
printf_filtered (_("Unable to read thread information "
"block for %s at address %s\n"),
target_pid_to_str (ptid),
- paddress (target_gdbarch, thread_local_base));
+ paddress (target_gdbarch (), thread_local_base));
return -1;
}
printf_filtered (_("Thread Information Block %s at %s\n"),
target_pid_to_str (ptid),
- paddress (target_gdbarch, thread_local_base));
+ paddress (target_gdbarch (), thread_local_base));
index = (gdb_byte *) tib;
diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c
index 46cf808..b72be5c 100644
--- a/gdb/xcoffsolib.c
+++ b/gdb/xcoffsolib.c
@@ -62,7 +62,7 @@ static void sharedlibrary_command (char *pattern, int from_tty);
static void
solib_info (char *args, int from_tty)
{
- int addr_size = gdbarch_addr_bit (target_gdbarch) / 8;
+ int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
struct vmap *vp = vmap;
/* Check for new shared libraries loaded with load (). */
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 19:08 ` Tom Tromey
@ 2012-11-09 19:14 ` Pedro Alves
2012-11-09 19:18 ` Tom Tromey
2012-11-09 19:40 ` should deprecated_target_gdbarch_select_hack be un-deprecated? Pedro Alves
2012-11-10 16:25 ` [PATCH] Multi-process + multi-arch: GDB Michael Eager
2 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2012-11-09 19:14 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 11/09/2012 07:07 PM, Tom Tromey wrote:
> I picked 'target_gdbarch ()' just due to the long history of using this
> name.
That's a good reasoning too.
> Here's the patch, let me know what you think. I made most of it with
> 'perl -pi'. I only touched gdbarch.sh by hand.
Looks good to me. Thanks!
> Note the short-ish ChangeLog. I could perhaps write a more detailed
> one, but in this case it hardly seemed worthwhile.
That's fine. That's what we've always done for large, but trivial
mechanical changes.
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 19:14 ` Pedro Alves
@ 2012-11-09 19:18 ` Tom Tromey
0 siblings, 0 replies; 17+ messages in thread
From: Tom Tromey @ 2012-11-09 19:18 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>> Here's the patch, let me know what you think. I made most of it with
>> 'perl -pi'. I only touched gdbarch.sh by hand.
Pedro> Looks good to me. Thanks!
Thanks. I'll put it in shortly.
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread
* should deprecated_target_gdbarch_select_hack be un-deprecated?
2012-11-09 19:08 ` Tom Tromey
2012-11-09 19:14 ` Pedro Alves
@ 2012-11-09 19:40 ` Pedro Alves
2012-11-13 21:17 ` Tom Tromey
2012-11-10 16:25 ` [PATCH] Multi-process + multi-arch: GDB Michael Eager
2 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2012-11-09 19:40 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 11/09/2012 07:07 PM, Tom Tromey wrote:
>
> Finally, I wonder whether deprecated_target_gdbarch_select_hack should
> be un-deprecated. The comment says:
>
> /* Helper function. Set the global "target_gdbarch" to "gdbarch".
>
> FIXME: kettenis/20031124: Of the functions that follow, only
> gdbarch_from_bfd is supposed to survive. The others will
> dissappear since in the future GDB will (hopefully) be truly
> multi-arch. However, for now we're still stuck with the concept of
> a single active architecture. */
>
> It seems to me that we have settled on a somewhat different design; but
> also that the badness indicated by this comment no longer exists.
Yes, I think so. We used to do nasty things with swapping out gdbarch's
fields, which I believe would be the gross "hack" part, but that is gone.
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-09 19:08 ` Tom Tromey
2012-11-09 19:14 ` Pedro Alves
2012-11-09 19:40 ` should deprecated_target_gdbarch_select_hack be un-deprecated? Pedro Alves
@ 2012-11-10 16:25 ` Michael Eager
2012-11-13 20:50 ` Tom Tromey
2 siblings, 1 reply; 17+ messages in thread
From: Michael Eager @ 2012-11-10 16:25 UTC (permalink / raw)
To: Tom Tromey; +Cc: Pedro Alves, gdb-patches
On 11/09/2012 11:07 AM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves<palves@redhat.com> writes:
> Pedro> I tried to follow the get_current_arch() precedent (was originally
> Pedro> current_gdbarch). Looking again, I messed up a bit, as get_target_arch()
> Pedro> would be even more in spirit.
>
> Pedro> But anyway is fine with me. You choose.;-)
>
> I picked 'target_gdbarch ()' just due to the long history of using this
> name.
I'd recommend get_target_arch() rather than recasting target_gdbarch
from a variable to a function. There are other get_target_* () functions
and this would parallel that usage. Another benefit: a more substantive
change in the name is less likely to be overlooked when adapting or backporting
patches.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-10 16:25 ` [PATCH] Multi-process + multi-arch: GDB Michael Eager
@ 2012-11-13 20:50 ` Tom Tromey
2012-11-14 13:48 ` Pedro Alves
0 siblings, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2012-11-13 20:50 UTC (permalink / raw)
To: Michael Eager; +Cc: Pedro Alves, gdb-patches
>>>>> "Michael" == Michael Eager <eager@eagerm.com> writes:
Michael> I'd recommend get_target_arch() rather than recasting
Michael> target_gdbarch from a variable to a function. There are other
Michael> get_target_* () functions and this would parallel that usage.
Michael> Another benefit: a more substantive change in the name is less
Michael> likely to be overlooked when adapting or backporting patches.
In this particular case, I don't think there are big problems that can
arise. target_gdbarch isn't used as a boolean, one of the major such
issues that can possibly arise. Other issues, I think, will be caught
by type-checking.
That said, I don't really care all that much about the name, and if
Pedro agrees I will rename it to something else.
Tom
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: should deprecated_target_gdbarch_select_hack be un-deprecated?
2012-11-09 19:40 ` should deprecated_target_gdbarch_select_hack be un-deprecated? Pedro Alves
@ 2012-11-13 21:17 ` Tom Tromey
2012-11-14 13:54 ` Pedro Alves
0 siblings, 1 reply; 17+ messages in thread
From: Tom Tromey @ 2012-11-13 21:17 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Tom> Finally, I wonder whether deprecated_target_gdbarch_select_hack should
Tom> be un-deprecated.
[...]
Pedro> Yes, I think so. We used to do nasty things with swapping out gdbarch's
Pedro> fields, which I believe would be the gross "hack" part, but that is gone.
How about this?
I think my only real concern is the name I chose.
Tom
2012-11-13 Tom Tromey <tromey@redhat.com>
* gdbarch.h, gdbarch.c: Rebuild.
* gdbarch.sh (select_target_gdbarch): Rename from
deprecated_target_gdbarch_select_hack.
* arch-utils.c (gdbarch_update_p): Update.
(set_gdbarch_from_file): Update.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 71d17cf..c755d6d 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -522,7 +522,7 @@ gdbarch_update_p (struct gdbarch_info info)
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
- deprecated_target_gdbarch_select_hack (new_gdbarch);
+ select_target_gdbarch (new_gdbarch);
return 1;
}
@@ -556,7 +556,7 @@ set_gdbarch_from_file (bfd *abfd)
if (gdbarch == NULL)
error (_("Architecture of file not recognized."));
- deprecated_target_gdbarch_select_hack (gdbarch);
+ select_target_gdbarch (gdbarch);
}
/* Initialize the current architecture. Update the ``set
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 26dd404..d119cc0 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4666,7 +4666,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* Make the specified architecture current. */
void
-deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
+select_target_gdbarch (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 9d2bac3..0e17ad0 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1382,15 +1382,9 @@ extern int gdbarch_update_p (struct gdbarch_info info);
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-/* Helper function. Set the global "target_gdbarch" to "gdbarch".
+/* Helper function. Set the target gdbarch to "gdbarch". */
- FIXME: kettenis/20031124: Of the functions that follow, only
- gdbarch_from_bfd is supposed to survive. The others will
- dissappear since in the future GDB will (hopefully) be truly
- multi-arch. However, for now we're still stuck with the concept of
- a single active architecture. */
-
-extern void deprecated_target_gdbarch_select_hack (struct gdbarch *gdbarch);
+extern void select_target_gdbarch (struct gdbarch *gdbarch);
/* Register per-architecture data-pointer.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 53a52b1..c4ab43f 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1331,15 +1331,9 @@ extern int gdbarch_update_p (struct gdbarch_info info);
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-/* Helper function. Set the global "target_gdbarch" to "gdbarch".
+/* Helper function. Set the target gdbarch to "gdbarch". */
- FIXME: kettenis/20031124: Of the functions that follow, only
- gdbarch_from_bfd is supposed to survive. The others will
- dissappear since in the future GDB will (hopefully) be truly
- multi-arch. However, for now we're still stuck with the concept of
- a single active architecture. */
-
-extern void deprecated_target_gdbarch_select_hack (struct gdbarch *gdbarch);
+extern void select_target_gdbarch (struct gdbarch *gdbarch);
/* Register per-architecture data-pointer.
@@ -2281,7 +2275,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* Make the specified architecture current. */
void
-deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
+select_target_gdbarch (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Multi-process + multi-arch: GDB
2012-11-13 20:50 ` Tom Tromey
@ 2012-11-14 13:48 ` Pedro Alves
0 siblings, 0 replies; 17+ messages in thread
From: Pedro Alves @ 2012-11-14 13:48 UTC (permalink / raw)
To: Tom Tromey; +Cc: Michael Eager, gdb-patches
On 11/13/2012 08:50 PM, Tom Tromey wrote:
>>>>>> "Michael" == Michael Eager <eager@eagerm.com> writes:
>
> Michael> I'd recommend get_target_arch() rather than recasting
> Michael> target_gdbarch from a variable to a function. There are other
> Michael> get_target_* () functions and this would parallel that usage.
> Michael> Another benefit: a more substantive change in the name is less
> Michael> likely to be overlooked when adapting or backporting patches.
>
> In this particular case, I don't think there are big problems that can
> arise. target_gdbarch isn't used as a boolean, one of the major such
> issues that can possibly arise. Other issues, I think, will be caught
> by type-checking.
I agree problems aren't likely.
> That said, I don't really care all that much about the name, and if
> Pedro agrees I will rename it to something else.
I don't care about it that much myself either.
Renaming it to get_target_arch is of course fine with me, having
proposed it myself originally, if someone wants to do the work.
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: should deprecated_target_gdbarch_select_hack be un-deprecated?
2012-11-13 21:17 ` Tom Tromey
@ 2012-11-14 13:54 ` Pedro Alves
2012-11-14 15:34 ` Tom Tromey
0 siblings, 1 reply; 17+ messages in thread
From: Pedro Alves @ 2012-11-14 13:54 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 11/13/2012 09:17 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Tom> Finally, I wonder whether deprecated_target_gdbarch_select_hack should
> Tom> be un-deprecated.
> [...]
>
> Pedro> Yes, I think so. We used to do nasty things with swapping out gdbarch's
> Pedro> fields, which I believe would be the gross "hack" part, but that is gone.
>
> How about this?
>
> I think my only real concern is the name I chose.
This is fine with me. My alternative suggestion would be "set_target_gdbarch",
as "set" is more traditional for a setter, which is what this function ended
up being.
--
Pedro Alves
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: should deprecated_target_gdbarch_select_hack be un-deprecated?
2012-11-14 13:54 ` Pedro Alves
@ 2012-11-14 15:34 ` Tom Tromey
0 siblings, 0 replies; 17+ messages in thread
From: Tom Tromey @ 2012-11-14 15:34 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> This is fine with me. My alternative suggestion would be
Pedro> "set_target_gdbarch", as "set" is more traditional for a setter,
Pedro> which is what this function ended up being.
Sounds good. Here is what I am checking in.
Tom
2012-11-13 Tom Tromey <tromey@redhat.com>
* gdbarch.h, gdbarch.c: Rebuild.
* gdbarch.sh (set_target_gdbarch): Rename from
deprecated_target_gdbarch_select_hack.
* arch-utils.c (gdbarch_update_p): Update.
(set_gdbarch_from_file): Update.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 71d17cf..5a47e37 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -522,7 +522,7 @@ gdbarch_update_p (struct gdbarch_info info)
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
- deprecated_target_gdbarch_select_hack (new_gdbarch);
+ set_target_gdbarch (new_gdbarch);
return 1;
}
@@ -556,7 +556,7 @@ set_gdbarch_from_file (bfd *abfd)
if (gdbarch == NULL)
error (_("Architecture of file not recognized."));
- deprecated_target_gdbarch_select_hack (gdbarch);
+ set_target_gdbarch (gdbarch);
}
/* Initialize the current architecture. Update the ``set
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 26dd404..09576b1 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4666,7 +4666,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* Make the specified architecture current. */
void
-deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
+set_target_gdbarch (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 9d2bac3..df09553 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1382,15 +1382,9 @@ extern int gdbarch_update_p (struct gdbarch_info info);
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-/* Helper function. Set the global "target_gdbarch" to "gdbarch".
+/* Helper function. Set the target gdbarch to "gdbarch". */
- FIXME: kettenis/20031124: Of the functions that follow, only
- gdbarch_from_bfd is supposed to survive. The others will
- dissappear since in the future GDB will (hopefully) be truly
- multi-arch. However, for now we're still stuck with the concept of
- a single active architecture. */
-
-extern void deprecated_target_gdbarch_select_hack (struct gdbarch *gdbarch);
+extern void set_target_gdbarch (struct gdbarch *gdbarch);
/* Register per-architecture data-pointer.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 53a52b1..4b11f92 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1331,15 +1331,9 @@ extern int gdbarch_update_p (struct gdbarch_info info);
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-/* Helper function. Set the global "target_gdbarch" to "gdbarch".
+/* Helper function. Set the target gdbarch to "gdbarch". */
- FIXME: kettenis/20031124: Of the functions that follow, only
- gdbarch_from_bfd is supposed to survive. The others will
- dissappear since in the future GDB will (hopefully) be truly
- multi-arch. However, for now we're still stuck with the concept of
- a single active architecture. */
-
-extern void deprecated_target_gdbarch_select_hack (struct gdbarch *gdbarch);
+extern void set_target_gdbarch (struct gdbarch *gdbarch);
/* Register per-architecture data-pointer.
@@ -2281,7 +2275,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* Make the specified architecture current. */
void
-deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
+set_target_gdbarch (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-11-14 15:34 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-09 1:52 [PATCH] Multi-process + multi-arch: GDB Pedro Alves
2012-11-09 5:26 ` H.J. Lu
2012-11-09 10:07 ` Pedro Alves
2012-11-09 18:24 ` Tom Tromey
2012-11-09 18:30 ` Pedro Alves
2012-11-09 18:32 ` Tom Tromey
2012-11-09 18:47 ` Pedro Alves
2012-11-09 19:08 ` Tom Tromey
2012-11-09 19:14 ` Pedro Alves
2012-11-09 19:18 ` Tom Tromey
2012-11-09 19:40 ` should deprecated_target_gdbarch_select_hack be un-deprecated? Pedro Alves
2012-11-13 21:17 ` Tom Tromey
2012-11-14 13:54 ` Pedro Alves
2012-11-14 15:34 ` Tom Tromey
2012-11-10 16:25 ` [PATCH] Multi-process + multi-arch: GDB Michael Eager
2012-11-13 20:50 ` Tom Tromey
2012-11-14 13:48 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox