mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
* 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.
This commit is contained in:
26
gdb/target.c
26
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.
|
||||
|
||||
Reference in New Issue
Block a user