From 67c2c32c6b30dd3690964884a46b39cc6ee27486 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Sat, 11 Aug 2001 00:41:02 +0000 Subject: [PATCH] * gdb-events.sh: Add architecture_changed event. * gdbarch.sh: Include gdb-event.h. (gdbarch_update_p): Notify UIs when architecture changes. * gdb-events.h: Regenerated. * gdb-events.c: Regenerated. * gdbarch.c: Regenerated. --- gdb/ChangeLog | 9 +++++++++ gdb/gdb-events.c | 23 +++++++++++++++++++++++ gdb/gdb-events.h | 4 ++++ gdb/gdb-events.sh | 1 + gdb/gdbarch.c | 5 ++++- gdb/gdbarch.sh | 5 ++++- 6 files changed, 45 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25d32330c96..b6775a4bb83 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2001-08-10 Keith Seitz + + * gdb-events.sh: Add architecture_changed event. + * gdbarch.sh: Include gdb-event.h. + (gdbarch_update_p): Notify UIs when architecture changes. + * gdb-events.h: Regenerated. + * gdb-events.c: Regenerated. + * gdbarch.c: Regenerated. + 2001-08-10 Michael Snyder * regcache.c (legacy_write_register_gen): Don't 'optimize out' diff --git a/gdb/gdb-events.c b/gdb/gdb-events.c index d1181088d98..0fbb3bab798 100644 --- a/gdb/gdb-events.c +++ b/gdb/gdb-events.c @@ -111,6 +111,16 @@ tracepoint_modify_event (int number) current_event_hooks->tracepoint_modify (number); } +void +architecture_changed_event (void) +{ + if (gdb_events_debug) + fprintf_unfiltered (gdb_stdlog, "architecture_changed_event\n"); + if (!current_event_hooks->architecture_changed) + return; + current_event_hooks->architecture_changed (); +} + #endif #if WITH_GDB_EVENTS @@ -134,6 +144,7 @@ enum gdb_event tracepoint_create, tracepoint_delete, tracepoint_modify, + architecture_changed, nr_gdb_events }; @@ -249,6 +260,14 @@ queue_tracepoint_modify (int number) append (event); } +static void +queue_architecture_changed (void) +{ + struct event *event = XMALLOC (struct event); + event->type = architecture_changed; + append (event); +} + void gdb_events_deliver (struct gdb_events *vector) { @@ -294,6 +313,9 @@ gdb_events_deliver (struct gdb_events *vector) vector->tracepoint_modify (event->data.tracepoint_modify.number); break; + case architecture_changed: + vector->architecture_changed (); + break; } delivering_events = event->next; xfree (event); @@ -312,6 +334,7 @@ _initialize_gdb_events (void) queue_event_hooks.tracepoint_create = queue_tracepoint_create; queue_event_hooks.tracepoint_delete = queue_tracepoint_delete; queue_event_hooks.tracepoint_modify = queue_tracepoint_modify; + queue_event_hooks.architecture_changed = queue_architecture_changed; #endif c = add_set_cmd ("eventdebug", class_maintenance, var_zinteger, diff --git a/gdb/gdb-events.h b/gdb/gdb-events.h index 7d0d86f38ec..18a4a2018c2 100644 --- a/gdb/gdb-events.h +++ b/gdb/gdb-events.h @@ -57,6 +57,7 @@ typedef void (gdb_events_breakpoint_modify_ftype) (int b); typedef void (gdb_events_tracepoint_create_ftype) (int number); typedef void (gdb_events_tracepoint_delete_ftype) (int number); typedef void (gdb_events_tracepoint_modify_ftype) (int number); +typedef void (gdb_events_architecture_changed_ftype) (void); /* gdb-events: object. */ @@ -69,6 +70,7 @@ struct gdb_events gdb_events_tracepoint_create_ftype *tracepoint_create; gdb_events_tracepoint_delete_ftype *tracepoint_delete; gdb_events_tracepoint_modify_ftype *tracepoint_modify; + gdb_events_architecture_changed_ftype *architecture_changed; }; @@ -81,6 +83,7 @@ extern void breakpoint_modify_event (int b); extern void tracepoint_create_event (int number); extern void tracepoint_delete_event (int number); extern void tracepoint_modify_event (int number); +extern void architecture_changed_event (void); /* When GDB_EVENTS are not being used, completly disable them. */ @@ -92,6 +95,7 @@ extern void tracepoint_modify_event (int number); #define tracepoint_create_event(number) 0 #define tracepoint_delete_event(number) 0 #define tracepoint_modify_event(number) 0 +#define architecture_changed_event() 0 #endif /* Install custom gdb-events hooks. */ diff --git a/gdb/gdb-events.sh b/gdb/gdb-events.sh index 6c576f813c1..eb7346551a0 100755 --- a/gdb/gdb-events.sh +++ b/gdb/gdb-events.sh @@ -64,6 +64,7 @@ f:void:breakpoint_modify:int b:b f:void:tracepoint_create:int number:number f:void:tracepoint_delete:int number:number f:void:tracepoint_modify:int number:number +f:void:architecture_changed:void #*:void:annotate_starting_hook:void #*:void:annotate_stopped_hook:void #*:void:annotate_signalled_hook:void diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 40da7a4d22d..be5cccf9e29 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -61,6 +61,7 @@ #include "floatformat.h" #include "gdb_assert.h" +#include "gdb-events.h" /* Static function declarations */ @@ -4733,6 +4734,7 @@ gdbarch_update_p (struct gdbarch_info info) new_gdbarch->bfd_arch_info->printable_name); current_gdbarch = new_gdbarch; swapin_gdbarch_swap (new_gdbarch); + architecture_changed_event (); return 1; } } @@ -4766,7 +4768,8 @@ gdbarch_update_p (struct gdbarch_info info) registered an interest in this architecture. CURRENT_GDBARCH must be updated before these modules are called. */ init_gdbarch_data (new_gdbarch); - + architecture_changed_event (); + if (gdbarch_debug) gdbarch_dump (current_gdbarch, gdb_stdlog); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 964e16f25ca..3b0387efb13 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1129,6 +1129,7 @@ cat <bfd_arch_info->printable_name); current_gdbarch = new_gdbarch; swapin_gdbarch_swap (new_gdbarch); + architecture_changed_event (); return 1; } } @@ -2099,7 +2101,8 @@ gdbarch_update_p (struct gdbarch_info info) registered an interest in this architecture. CURRENT_GDBARCH must be updated before these modules are called. */ init_gdbarch_data (new_gdbarch); - + architecture_changed_event (); + if (gdbarch_debug) gdbarch_dump (current_gdbarch, gdb_stdlog); -- 2.30.2