aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-03-23 09:46:49 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-03-23 09:50:36 -0400
commitc8fbd44a018a9923f906bfd2be5489caa87b602a (patch)
treee671690688c207daef290a5e0a4857712dab73a7 /gdb
parent02980c5645e355833b989e9551befddd54e75640 (diff)
downloadfsf-binutils-gdb-c8fbd44a018a9923f906bfd2be5489caa87b602a.zip
fsf-binutils-gdb-c8fbd44a018a9923f906bfd2be5489caa87b602a.tar.gz
fsf-binutils-gdb-c8fbd44a018a9923f906bfd2be5489caa87b602a.tar.bz2
gdb: remove target_is_pushed free function
Same principle as the previous patches. gdb/ChangeLog: * target.h (target_is_pushed): Remove, update callers to use inferior::target_is_pushed instead. * target.c (target_is_pushed): Remove. Change-Id: I9862e6205acc65672da807cbe4b46cde009e7b9d
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/darwin-nat.c2
-rw-r--r--gdb/gnu-nat.c5
-rw-r--r--gdb/go32-nat.c2
-rw-r--r--gdb/inf-ptrace.c15
-rw-r--r--gdb/nto-procfs.c4
-rw-r--r--gdb/procfs.c4
-rw-r--r--gdb/target.c11
-rw-r--r--gdb/target.h2
-rw-r--r--gdb/windows-nat.c2
10 files changed, 24 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 274e157..b6639ee 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2021-03-23 Simon Marchi <simon.marchi@polymtl.ca>
+ * target.h (target_is_pushed): Remove, update callers to use
+ inferior::target_is_pushed instead.
+ * target.c (target_is_pushed): Remove.
+
+2021-03-23 Simon Marchi <simon.marchi@polymtl.ca>
+
* target.h (push_target): Remove, update callers to use
inferior::push_target.
* target.c (push_target): Remove.
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index f8e4443..587f531 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1658,7 +1658,7 @@ darwin_attach_pid (struct inferior *inf)
}
target_ops *darwin_ops = get_native_target ();
- if (!target_is_pushed (darwin_ops))
+ if (!inf->target_is_pushed (darwin_ops))
inf->push_target (darwin_ops);
}
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 9ea4c40..816f901 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2109,12 +2109,13 @@ gnu_nat_target::create_inferior (const char *exec_file,
int from_tty)
{
struct inf *inf = cur_inf ();
+ inferior *inferior = current_inferior ();
int pid;
inf_debug (inf, "creating inferior");
- if (!target_is_pushed (this))
- current_inferior ()->push_target (this);
+ if (!inf->target_is_pushed (this))
+ inf->push_target (this);
pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
NULL, NULL, NULL, NULL);
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 79c31fc..9899545 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -756,7 +756,7 @@ go32_nat_target::create_inferior (const char *exec_file,
inf = current_inferior ();
inferior_appeared (inf, SOME_PID);
- if (!target_is_pushed (this))
+ if (!inf->target_is_pushed (this))
inf->push_target (this);
thread_info *thr = add_thread_silent (ptid_t (SOME_PID));
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index e630ba44..b6fa71f 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -74,15 +74,17 @@ inf_ptrace_target::create_inferior (const char *exec_file,
const std::string &allargs,
char **env, int from_tty)
{
+ inferior *inf = current_inferior ();
+
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
- int ops_already_pushed = target_is_pushed (this);
+ int ops_already_pushed = inf->target_is_pushed (this);
target_unpush_up unpusher;
if (! ops_already_pushed)
{
/* Clear possible core file with its process_stratum. */
- current_inferior ()->push_target (this);
+ inf->push_target (this);
unpusher.reset (this);
}
@@ -127,20 +129,17 @@ inf_ptrace_target::mourn_inferior ()
void
inf_ptrace_target::attach (const char *args, int from_tty)
{
- pid_t pid;
- struct inferior *inf;
+ inferior *inf = current_inferior ();
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
- int ops_already_pushed = target_is_pushed (this);
+ int ops_already_pushed = inf->target_is_pushed (this);
- pid = parse_pid_to_attach (args);
+ pid_t pid = parse_pid_to_attach (args);
if (pid == getpid ()) /* Trying to masturbate? */
error (_("I refuse to debug myself!"));
- inf = current_inferior ();
-
target_unpush_up unpusher;
if (! ops_already_pushed)
{
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index b74392f..41b436c 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -717,7 +717,7 @@ nto_procfs_target::attach (const char *args, int from_tty)
inferior_appeared (inf, pid);
inf->attach_flag = 1;
- if (!target_is_pushed (ops))
+ if (!inf->target_is_pushed (ops))
inf->push_target (ops);
update_thread_list ();
@@ -1318,7 +1318,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
/* warning( "Failed to set Kill-on-Last-Close flag: errno = %d(%s)\n",
errn, safe_strerror(errn) ); */
}
- if (!target_is_pushed (ops))
+ if (!inf->target_is_pushed (ops))
inf->push_target (ops);
target_terminal::init ();
diff --git a/gdb/procfs.c b/gdb/procfs.c
index b376809..91d2039 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1769,7 +1769,7 @@ procfs_target::attach (const char *args, int from_tty)
/* Push the target if needed, ensure it gets un-pushed it if attach fails. */
target_unpush_up unpusher;
- if (!target_is_pushed (this))
+ if (!inf->target_is_pushed (this))
{
current_inferior ()->push_target (this);
unpusher.reset (this);
@@ -2862,7 +2862,7 @@ procfs_target::create_inferior (const char *exec_file,
shell_file = tryname;
}
- if (!target_is_pushed (this))
+ if (!inf->target_is_pushed (this))
current_inferior ()->push_target (this);
pid = fork_inferior (exec_file, allargs, env, procfs_set_exec_trap,
diff --git a/gdb/target.c b/gdb/target.c
index fe97312..afc4b2c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -647,15 +647,6 @@ pop_all_targets (void)
pop_all_targets_above (dummy_stratum);
}
-/* Return true if T is now pushed in the current inferior's target
- stack. Return false otherwise. */
-
-bool
-target_is_pushed (target_ops *t)
-{
- return current_inferior ()->target_is_pushed (t);
-}
-
void
target_unpusher::operator() (struct target_ops *ops) const
{
@@ -3097,7 +3088,7 @@ debug_target::info () const
void
target_close (struct target_ops *targ)
{
- gdb_assert (!target_is_pushed (targ));
+ gdb_assert (!current_inferior ()->target_is_pushed (targ));
fileio_handles_invalidate_target (targ);
diff --git a/gdb/target.h b/gdb/target.h
index 1830d3a..6b71e74 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2411,8 +2411,6 @@ extern void pop_all_targets_at_and_above (enum strata stratum);
strictly above ABOVE_STRATUM. */
extern void pop_all_targets_above (enum strata above_stratum);
-extern bool target_is_pushed (target_ops *t);
-
extern CORE_ADDR target_translate_tls_address (struct objfile *objfile,
CORE_ADDR offset);
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 5166289..00f8353 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2028,7 +2028,7 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching)
current_event.dwProcessId = pid;
memset (&current_event, 0, sizeof (current_event));
inf = current_inferior ();
- if (!target_is_pushed (this))
+ if (!inf->target_is_pushed (this))
inf->push_target (this);
disable_breakpoints_in_shlibs ();
windows_clear_solib ();