diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-11-28 22:10:26 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-11-28 22:10:26 +0000 |
commit | 424163ea1524c5823612a24284cb900cd70e2e2b (patch) | |
tree | 5904b83f46fcb044c58f6fefa6f720d578d6bfce /gdb/target.c | |
parent | 979894f2c29bdd6ce92b9588e308dbaeaf9ac819 (diff) | |
download | gdb-424163ea1524c5823612a24284cb900cd70e2e2b.zip gdb-424163ea1524c5823612a24284cb900cd70e2e2b.tar.gz gdb-424163ea1524c5823612a24284cb900cd70e2e2b.tar.bz2 |
* Makefile.in (SFILES): Add new and missed files.
(target_descriptions_h): New.
(COMMON_OBS): Add target-descriptions.o.
(arch-utils.o, infcmd.o, remote.o, target.o): Update.
(target-descriptions.o): New.
* arch-utils.c (gdbarch_info_fill): Check for a target
description.
* target-descriptions.c, target-descriptions.h: New files.
* gdbarch.sh: Add target_desc to info. Declare it in gdbarch.h.
Correct typos.
(gdbarch_list_lookup_by_info): Check target_desc.
* gdbarch.c, gdbarch.h: Regenerated.
* target.c (update_current_target): Mention to_read_description.
(target_pre_inferior): Call target_clear_description.
(target_read_description): New.
* target.h (struct target_ops): Add to_read_description.
(target_read_description): New prototype.
* infcmd.c (post_create_inferior): Call target_find_description.
* remote.c (remote_open_1): Likewise.
(extended_remote_create_inferior): Add a comment.
(extended_remote_async_create_inferior): Likewise.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c index 2062733..349f1b6 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -40,6 +40,7 @@ #include "gdb_assert.h" #include "gdbcore.h" #include "exceptions.h" +#include "target-descriptions.h" static void target_info (char *, int); @@ -464,6 +465,7 @@ update_current_target (void) INHERIT (to_find_memory_regions, t); INHERIT (to_make_corefile_notes, t); INHERIT (to_get_thread_local_address, t); + /* Do not inherit to_read_description. */ INHERIT (to_magic, t); /* Do not inherit to_memory_map. */ /* Do not inherit to_flash_erase. */ @@ -641,6 +643,7 @@ update_current_target (void) de_fault (to_async, (void (*) (void (*) (enum inferior_event_type, void*), void*)) tcomplain); + current_target.to_read_description = NULL; #undef de_fault /* Finally, position the target-stack beneath the squashed @@ -1602,6 +1605,8 @@ void target_pre_inferior (int from_tty) { invalidate_target_mem_regions (); + + target_clear_description (); } /* This is to be called by the open routine before it does @@ -1689,6 +1694,27 @@ target_follow_fork (int follow_child) "could not find a target to follow fork"); } +/* Look for a target which can describe architectural features, starting + from TARGET. If we find one, return its description. */ + +const struct target_desc * +target_read_description (struct target_ops *target) +{ + struct target_ops *t; + + for (t = target; t != NULL; t = t->beneath) + if (t->to_read_description != NULL) + { + const struct target_desc *tdesc; + + tdesc = t->to_read_description (t); + if (tdesc) + return tdesc; + } + + return NULL; +} + /* Look through the list of possible targets for a target that can execute a run or attach command without any other data. This is used to locate the default process stratum. |