aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-05-27 06:48:20 +0000
committerAndrew Cagney <cagney@redhat.com>1997-05-27 06:48:20 +0000
commit2f2e6c5d5bf76a01caa0d2da27ac21e45ee2276e (patch)
treee423d11adc8c988ab292d78c6e7a592064ac5ead /sim/common
parentd82e4bf6cc9f6dfb853b2c9fa138b3640381fdf6 (diff)
downloadgdb-2f2e6c5d5bf76a01caa0d2da27ac21e45ee2276e.zip
gdb-2f2e6c5d5bf76a01caa0d2da27ac21e45ee2276e.tar.gz
gdb-2f2e6c5d5bf76a01caa0d2da27ac21e45ee2276e.tar.bz2
Extend xor-endian and per-cpu support in core module.
Allow negated test when watching value within core.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog46
-rw-r--r--sim/common/sim-events.c18
-rw-r--r--sim/common/sim-n-core.h14
-rw-r--r--sim/common/sim-options.c49
-rw-r--r--sim/common/sim-watch.h1
5 files changed, 95 insertions, 33 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 6421e70..5c57fef 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,49 @@
+Tue May 27 14:32:00 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-watch.c (schedule_watchpoint): Add is_within option so that
+ inequality test is possible.
+ (handle_watchpoint): Re-pass is_within arg.
+ (watch_option_handler): When `!' prefix to pc-watchpoint arg pass
+ 0 to schedule_watchpoint's is_within arg.
+ (sim_watchpoint_init): Re-pass is_within arg.
+
+ * sim-options.c (sim_print_help): Add is_command argument. Don't
+ include -- prefix when called from the command line interpreter.
+
+ * sim-watch.c (schedule_watchpoint): Pass true is_within argument.
+
+ * sim-events.c (sim_events_watch_sim): Add is_within argument,
+ zero indicates that the test should be reversed.
+ (sim_events_watch_core): Ditto.
+ (WATCH_CORE): Compare range against is_within.
+ (WATCH_SIM): Ditto.
+
+Tue May 27 12:48:03 1997 Andrew Cagney <cagney@b2.cygnus.com>
+
+ * sim-events.c (WATCH_CORE): Pass NULL cpu argument to
+ sim_core_read_buffer. Check nr-bytes transfered.
+
+ * sim-core.h (sim_core_common): Define a new struct that contains
+ the common data. to sd and cpu structures.
+ * sim-core.c (sim_core_attach): Update.
+ (sim_core_init): Update. Remember to copy initialized data to each
+ cpu.
+ (sim_core_find_mapping): Ditto.
+
+ * sim-core.c (sim_core_read_buffer): Add cpu argument.
+ (sim_core_write_buffer): Ditto.
+
+ * sim-n-core.h (sim_core_read_unaligned_N): When mis-aligned
+ transfer use xor version of read buffer.
+ (sim_core_write_unaligned_N): Ditto for write.
+
+ * sim-core.c (sim_core_xor_read_buffer): New function implement
+ xor-endian data read breaking transfer up into xor-endian sized
+ blocks.
+ (sim_core_xor_write_buffer): Ditto for write.
+ (reverse_n): Reverse order of arbitrary number of bytes in buffer
+ - needed for xor-endian transfers.
+
Fri May 23 14:24:31 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-inline.h: Review description.
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index 0053fbb..3d2d005 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -93,6 +93,7 @@ struct _sim_event {
/* watch sim addr */
void *host_addr;
/* watch core/sim range */
+ int is_within; /* 0/1 */
unsigned ub;
unsigned lb;
unsigned64 ub64;
@@ -474,6 +475,7 @@ sim_events_watch_sim (SIM_DESC sd,
void *host_addr,
int nr_bytes,
int byte_order,
+ int is_within,
unsigned64 lb,
unsigned64 ub,
sim_event_handler *handler,
@@ -526,6 +528,7 @@ sim_events_watch_sim (SIM_DESC sd,
new_event->lb64 = lb;
new_event->ub = ub;
new_event->ub64 = ub;
+ new_event->is_within = (is_within != 0);
/* insert */
new_event->next = events->watchpoints;
events->watchpoints = new_event;
@@ -550,6 +553,7 @@ sim_events_watch_core (SIM_DESC sd,
sim_core_maps core_map,
int nr_bytes,
int byte_order,
+ int is_within,
unsigned64 lb,
unsigned64 ub,
sim_event_handler *handler,
@@ -603,6 +607,7 @@ sim_events_watch_core (SIM_DESC sd,
new_event->lb64 = lb;
new_event->ub = ub;
new_event->ub64 = ub;
+ new_event->is_within = (is_within != 0);
/* insert */
new_event->next = events->watchpoints;
events->watchpoints = new_event;
@@ -672,10 +677,13 @@ sim_watch_valid (SIM_DESC sd,
#define WATCH_CORE(N,OP,EXT) \
{ \
- unsigned_##N word; \
- sim_core_read_buffer (sd, to_do->core_map, &word, to_do->core_addr, sizeof (word)); \
+ unsigned_##N word = 0; \
+ int nr_read = sim_core_read_buffer (sd, NULL, to_do->core_map, &word, to_do->core_addr, sizeof (word)); \
OP (word); \
- return (word >= to_do->lb##EXT && word <= to_do->ub##EXT); \
+ return (nr_read == sizeof (unsigned_##N) \
+ && (to_do->is_within \
+ == (word >= to_do->lb##EXT \
+ && word <= to_do->ub##EXT))); \
}
case watch_core_targ_1: WATCH_CORE (1, T2H,);
case watch_core_targ_2: WATCH_CORE (2, T2H,);
@@ -697,7 +705,9 @@ sim_watch_valid (SIM_DESC sd,
{ \
unsigned_##N word = *(unsigned_##N*)to_do->host_addr; \
OP (word); \
- return (word >= to_do->lb##EXT && word <= to_do->ub##EXT); \
+ return (to_do->is_within \
+ == (word >= to_do->lb##EXT \
+ && word <= to_do->ub##EXT)); \
}
case watch_sim_host_1: WATCH_SIM (1, word = ,);
diff --git a/sim/common/sim-n-core.h b/sim/common/sim-n-core.h
index a0570e1..614a32f 100644
--- a/sim/common/sim-n-core.h
+++ b/sim/common/sim-n-core.h
@@ -43,7 +43,7 @@ sim_core_read_aligned_N(sim_cpu *cpu,
unsigned_word xaddr)
{
sim_cpu_core *cpu_core = CPU_CORE (cpu);
- sim_core *core = &cpu_core->common;
+ sim_core_common *core = &cpu_core->common;
unsigned_N val;
sim_core_mapping *mapping;
address_word addr;
@@ -106,8 +106,8 @@ sim_core_read_unaligned_N(sim_cpu *cpu,
case NONSTRICT_ALIGNMENT:
{
unsigned_N val;
- if (sim_core_read_buffer (CPU_STATE (cpu), map, &val, addr,
- sizeof(unsigned_N))
+ if (sim_core_xor_read_buffer (CPU_STATE (cpu), cpu, map, &val, addr,
+ sizeof(unsigned_N))
!= sizeof(unsigned_N))
SIM_CORE_SIGNAL (CPU_STATE (cpu), cpu, cia, map,
sizeof (unsigned_N), addr,
@@ -139,7 +139,7 @@ sim_core_write_aligned_N(sim_cpu *cpu,
unsigned_N val)
{
sim_cpu_core *cpu_core = CPU_CORE (cpu);
- sim_core *core = &cpu_core->common;
+ sim_core_common *core = &cpu_core->common;
sim_core_mapping *mapping;
address_word addr;
if (WITH_XOR_ENDIAN)
@@ -201,9 +201,9 @@ sim_core_write_unaligned_N(sim_cpu *cpu,
break;
case NONSTRICT_ALIGNMENT:
{
- val = T2H_N(val);
- if (sim_core_write_buffer (CPU_STATE (cpu), map, &val, addr,
- sizeof(unsigned_N))
+ unsigned_N val = H2T_N (val);
+ if (sim_core_xor_write_buffer (CPU_STATE (cpu), cpu, map, &val, addr,
+ sizeof(unsigned_N))
!= sizeof(unsigned_N))
SIM_CORE_SIGNAL (CPU_STATE (cpu), cpu, cia, map,
sizeof (unsigned_N), addr,
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 4f8890b..7a8dbe7 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -239,7 +239,7 @@ standard_option_handler (sd, opt, arg, is_command)
break;
case 'H':
- sim_print_help (sd);
+ sim_print_help (sd, is_command);
if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE)
exit (0);
/* FIXME: 'twould be nice to do something similar if gdb. */
@@ -391,8 +391,9 @@ sim_parse_args (sd, argv)
/* Print help messages for the options. */
void
-sim_print_help (sd)
+sim_print_help (sd, is_command)
SIM_DESC sd;
+ int is_command;
{
const struct option_list *ol;
const OPTION *opt;
@@ -425,32 +426,35 @@ sim_print_help (sd)
comma = 0;
len = 2;
- o = opt;
- do
+ if (!is_command)
{
- if (o->shortopt != '\0')
+ o = opt;
+ do
{
- sim_io_printf (sd, "%s-%c", comma ? ", " : "", o->shortopt);
- len += (comma ? 2 : 0) + 2;
- if (o->arg != NULL)
+ if (o->shortopt != '\0')
{
- if (o->opt.has_arg == optional_argument)
- {
- sim_io_printf (sd, "[%s]", o->arg);
- len += 1 + strlen (o->arg) + 1;
- }
- else
+ sim_io_printf (sd, "%s-%c", comma ? ", " : "", o->shortopt);
+ len += (comma ? 2 : 0) + 2;
+ if (o->arg != NULL)
{
- sim_io_printf (sd, " %s", o->arg);
- len += 1 + strlen (o->arg);
+ if (o->opt.has_arg == optional_argument)
+ {
+ sim_io_printf (sd, "[%s]", o->arg);
+ len += 1 + strlen (o->arg) + 1;
+ }
+ else
+ {
+ sim_io_printf (sd, " %s", o->arg);
+ len += 1 + strlen (o->arg);
+ }
}
+ comma = 1;
}
- comma = 1;
+ ++o;
}
- ++o;
+ while (o->opt.name != NULL && o->doc == NULL);
}
- while (o->opt.name != NULL && o->doc == NULL);
-
+
o = opt;
do
{
@@ -461,11 +465,12 @@ sim_print_help (sd)
name = o->opt.name;
if (name != NULL)
{
- sim_io_printf (sd, "%s--%s",
+ sim_io_printf (sd, "%s%s%s",
comma ? ", " : "",
+ is_command ? "" : "--",
name);
len += ((comma ? 2 : 0)
- + 2
+ + (is_command ? 0 : 2)
+ strlen (name));
if (o->arg != NULL)
{
diff --git a/sim/common/sim-watch.h b/sim/common/sim-watch.h
index b101ebb..9d4e842 100644
--- a/sim/common/sim-watch.h
+++ b/sim/common/sim-watch.h
@@ -38,6 +38,7 @@ typedef enum {
typedef struct _sim_watch_point {
watchpoint_action action;
+ int is_within;
long arg;
sim_event *event;
} sim_watch_point;