From: Tom Tromey Date: Mon, 4 Mar 2019 20:37:59 +0000 (-0700) Subject: Change the_dummy_target to be a global X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06b5b831a09417bac37b44599dc35d4b904700c5;p=binutils-gdb.git Change the_dummy_target to be a global While debugging gdb, I printed the target stack and got: (top-gdb) p g_target_stack $10 = { m_top = thread_stratum, m_stack = {0x142b0b0, 0x13da600 , 0x1c70690, 0x13d63b0 , 0x0, 0x0, 0x0} } (This is clearly from before the change to make ravenscar multi-target-capable.) Here, 0x142b0b0 is the singleton dummy target. It seems to me that since this is always a singleton, it would be a bit nicer if it were a global, so that it would be noted in the above. This patch implements this idea, and now I get: (top-gdb) p g_target_stack $2 = { m_top = dummy_stratum, m_stack = {0x1f1b040 , 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} } I did not do the same for the debug target. It didn't seem as useful to me. gdb/ChangeLog 2019-03-05 Tom Tromey * target.c (the_dummy_target): Move later. Change type to "dummy_target". (initialize_targets): Don't initialize the_dummy_target. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 359d222be4d..120cce01ca9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-03-05 Tom Tromey + + * target.c (the_dummy_target): Move later. Change type to + "dummy_target". + (initialize_targets): Don't initialize the_dummy_target. + 2019-03-05 Tom Tromey * gdb_bfd.c (gdb_bfd_fdopenr): Remove. diff --git a/gdb/target.c b/gdb/target.c index fe7cb08b994..8579c19d053 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -106,10 +106,8 @@ static enum exec_direction_kind default_execution_direction static std::unordered_map target_factories; -/* The initial current target, so that there is always a semi-valid - current target. */ +/* The singleton debug target. */ -static struct target_ops *the_dummy_target; static struct target_ops *the_debug_target; /* The target stack. */ @@ -3239,6 +3237,10 @@ dummy_make_corefile_notes (struct target_ops *self, #include "target-delegates.c" +/* The initial current target, so that there is always a semi-valid + current target. */ + +static dummy_target the_dummy_target; static const target_info dummy_target_info = { "None", @@ -3976,8 +3978,7 @@ set_write_memory_permission (const char *args, int from_tty, void initialize_targets (void) { - the_dummy_target = new dummy_target (); - push_target (the_dummy_target); + push_target (&the_dummy_target); the_debug_target = new debug_target ();