aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-03-23 00:30:52 -0400
committerMike Frysinger <vapier@gentoo.org>2021-01-30 10:14:21 -0500
commitd4e3adda1225d29b99f7bc81cc711806ecaacb70 (patch)
tree9e28132b4b36b74d943160bfb5aa7dd03e19b494
parent18d4b488f4538f11cfdc618ddfb26eaf2c955fb7 (diff)
downloadgdb-d4e3adda1225d29b99f7bc81cc711806ecaacb70.zip
gdb-d4e3adda1225d29b99f7bc81cc711806ecaacb70.tar.gz
gdb-d4e3adda1225d29b99f7bc81cc711806ecaacb70.tar.bz2
sim: watchpoints: change sizeof_pc to sizeof(sim_cia)
Existing ports already have sizeof_pc set to the same size as sim_cia, so simply make that part of the core code. We already assume this in places by way of sim_pc_{get,set}, and this is how it's documented in the sim-base.h API. There is code to allow sims to pick different register word sizes from address sizes, but most ports use the defaults for both (32-bits), and the few that support multiple register sizes never change the address size (so address defaults to register). I can't think of any machine where the register hardware size would be larger than the address word size either. We have ABIs that behave that way (e.g. x32), but the hardware is still equivalent register sized.
-rw-r--r--sim/ChangeLog4
-rw-r--r--sim/README-HACKING4
-rw-r--r--sim/avr/ChangeLog4
-rw-r--r--sim/avr/interp.c1
-rw-r--r--sim/bfin/ChangeLog4
-rw-r--r--sim/bfin/interp.c1
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/sim-watch.c6
-rw-r--r--sim/common/sim-watch.h1
-rw-r--r--sim/frv/ChangeLog4
-rw-r--r--sim/frv/sim-if.c1
-rw-r--r--sim/iq2000/ChangeLog4
-rw-r--r--sim/iq2000/sim-if.c1
-rw-r--r--sim/m32r/ChangeLog4
-rw-r--r--sim/m32r/sim-if.c1
-rw-r--r--sim/mips/ChangeLog4
-rw-r--r--sim/mips/interp.c1
-rw-r--r--sim/mn10300/ChangeLog4
-rw-r--r--sim/mn10300/interp.c1
-rw-r--r--sim/moxie/ChangeLog4
-rw-r--r--sim/moxie/interp.c1
-rw-r--r--sim/v850/ChangeLog4
-rw-r--r--sim/v850/interp.c1
23 files changed, 50 insertions, 16 deletions
diff --git a/sim/ChangeLog b/sim/ChangeLog
index b42b824..5e1ebca 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * README-HACKING: Delete reference to sizeof_pc.
+
2021-01-29 Mike Frysinger <vapier@gentoo.org>
* MAINTAINERS (Global Maintainers): Move myself back.
diff --git a/sim/README-HACKING b/sim/README-HACKING
index 583a559..9953f99 100644
--- a/sim/README-HACKING
+++ b/sim/README-HACKING
@@ -267,10 +267,8 @@ And in your insn fetcher:
PROFILE_COUNT_CORE (cpu, target_addr, size_in_bytes, map_exec);
To use the PC profiling code, you simply have to tell the system where to find
-your simulator's PC and its size. So in your sim_open() function:
+your simulator's PC. So in your sim_open() function:
STATE_WATCHPOINTS (sd)->pc = address_of_cpu0_pc;
- STATE_WATCHPOINTS (sd)->sizeof_pc = number_of_bytes_for_pc_storage;
-In a typical 32bit system, the sizeof_pc will be 4 bytes.
To profile branches, in every location where a branch insn is executed, call
one of the related helpers:
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog
index 0f837b2..2854ff8 100644
--- a/sim/avr/ChangeLog
+++ b/sim/avr/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index 3aff881..ba89eb5 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -1694,7 +1694,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
/* XXX: Only first core gets profiled ? */
SIM_CPU *cpu = STATE_CPU (sd, 0);
STATE_WATCHPOINTS (sd)->pc = &cpu->pc;
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (cpu->pc);
}
if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 36acbdc..70910b2 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index e26a822..ef23de3 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -733,7 +733,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
/* XXX: Only first core gets profiled ? */
SIM_CPU *cpu = STATE_CPU (sd, 0);
STATE_WATCHPOINTS (sd)->pc = &PCREG;
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PCREG);
}
if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index dbf030d..c7d6439 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
2021-01-30 Mike Frysinger <vapier@gentoo.org>
+ * sim-watch.c (schedule_watchpoint): Change sizeof_pc to sizeof
+ sim_cia.
+ * sim-watch.h (struct _sim_watchpoints): Delete sizeof_pc.
+
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
* sim-profile.c (profile_pc_init): Change 1 in shifts to 1ULL.
2021-01-30 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 6d17729..9ccd472 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -172,7 +172,7 @@ schedule_watchpoint (SIM_DESC sd,
case pc_watchpoint:
point->event = sim_events_watch_sim (sd,
watch->pc,
- watch->sizeof_pc,
+ sizeof (sim_cia),
HOST_BYTE_ORDER,
point->is_within,
point->arg0, point->arg1,
@@ -377,8 +377,8 @@ static const OPTION watchpoint_options[] =
static const char *default_interrupt_names[] = { "int", 0, };
/* This default handler is "good enough" for targets that just want to trap into
- gdb when watchpoints are hit, and have only configured STATE_WATCHPOINTS pc &
- sizeof_pc fields. */
+ gdb when watchpoints are hit, and have only configured the STATE_WATCHPOINTS
+ pc field. */
static void
default_interrupt_handler (SIM_DESC sd, void *data)
{
diff --git a/sim/common/sim-watch.h b/sim/common/sim-watch.h
index 1fd66fc..52a8d12 100644
--- a/sim/common/sim-watch.h
+++ b/sim/common/sim-watch.h
@@ -50,7 +50,6 @@ typedef struct _sim_watchpoints {
/* FIXME: In the future this shall be generalized so that any of the
N processors M registers can be watched */
void *pc;
- int sizeof_pc;
/* Pointer to the handler for interrupt watchpoints */
/* FIXME: can this be done better? */
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index 5fa0362..83770c3 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Call SIM_AC_OPTION_WARNINGS.
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index 636890b..bea8400 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -66,7 +66,6 @@ sim_open (kind, callback, abfd, argv)
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
STATE_WATCHPOINTS (sd)->pc = &(PC);
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
}
#endif
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index f609759..79e4939 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Call SIM_AC_OPTION_WARNINGS.
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 0716940..de90e73 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -72,7 +72,6 @@ sim_open (kind, callback, abfd, argv)
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
STATE_WATCHPOINTS (sd)->pc = &(PC);
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
}
#endif
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 551e12b..73e0064 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Call SIM_AC_OPTION_WARNINGS.
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index 08003b5..2d2f5e4 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -66,7 +66,6 @@ sim_open (kind, callback, abfd, argv)
{
SIM_CPU *current_cpu = STATE_CPU (sd, 0);
STATE_WATCHPOINTS (sd)->pc = &(PC);
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
}
#endif
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 94827d5..068d306 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 49e5f71..852f362 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -356,7 +356,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
/* FIXME: watchpoints code shouldn't need this */
STATE_WATCHPOINTS (sd)->pc = &(PC);
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
STATE_WATCHPOINTS (sd)->interrupt_handler = interrupt_event;
/* Initialize the mechanism for doing insn profiling. */
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 3932e81..45fdcad 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 418f3f0..c41797a 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -103,7 +103,6 @@ sim_open (SIM_OPEN_KIND kind,
moment, only support watchpoints causing a breakpoint (gdb
halt). */
STATE_WATCHPOINTS (sd)->pc = &(PC);
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
STATE_WATCHPOINTS (sd)->interrupt_handler = NULL;
STATE_WATCHPOINTS (sd)->interrupt_names = NULL;
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index c01b323..4a10ac3 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index f895af6..c5f9ed6 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -1204,7 +1204,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
STATE_WATCHPOINTS (sd)->pc = &cpu.asregs.regs[PC_REGNO];
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (word);
if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
{
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index 4f2ccc7..b99ca24 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_open): Delete STATE_WATCHPOINTS (sd)->sizeof_pc.
+
2021-01-11 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index 10d8a67..24d7ddc 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -203,7 +203,6 @@ sim_open (SIM_OPEN_KIND kind,
/* FIXME: should be better way of setting up interrupts */
STATE_WATCHPOINTS (sd)->pc = &(PC);
- STATE_WATCHPOINTS (sd)->sizeof_pc = sizeof (PC);
STATE_WATCHPOINTS (sd)->interrupt_handler = do_interrupt;
STATE_WATCHPOINTS (sd)->interrupt_names = interrupt_names;