From fadf6add3028d477457c809f60f07643964d7fd2 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 23 Mar 2021 09:50:32 -0400 Subject: gdb: remove unpush_target free function unpush_target unpushes the passed-in target from the current inferior's target stack. Calling it is therefore an implicit dependency on the current global inferior. Remove that function and make the callers use the inferior::unpush_target method directly. This sometimes allows using the inferior from the context rather than the global current inferior. target_unpusher::operator() now needs to be implemented in target.c, otherwise target.h and inferior.h both need to include each other, and that wouldn't work. gdb/ChangeLog: * target.h (unpush_target): Remove, update all callers to use `inferior::unpush_target` instead. (struct target_unpusher) : Just declare. * target.c (unpush_target): Remove. (target_unpusher::operator()): New. Change-Id: Ia5172dfb3f373e0a75b991885b50322ca2142a8c --- gdb/tracefile-tfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/tracefile-tfile.c') diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index ca6324c..ea70364 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -481,7 +481,7 @@ tfile_target_open (const char *arg, int from_tty) /* Looks semi-reasonable. Toss the old trace file and work on the new. */ - unpush_target (&tfile_ops); + current_inferior ()->unpush_target (&tfile_ops); trace_filename = filename.release (); trace_fd = scratch_chan; @@ -551,7 +551,7 @@ tfile_target_open (const char *arg, int from_tty) catch (const gdb_exception &ex) { /* Remove the partially set up target. */ - unpush_target (&tfile_ops); + current_inferior ()->unpush_target (&tfile_ops); throw; } -- cgit v1.1