aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-03-28 16:37:08 +0000
committerPedro Alves <palves@redhat.com>2008-03-28 16:37:08 +0000
commit5f667f2da0743a684b20714b4c72da4696ff1c22 (patch)
tree4f9c8bee91b5a92ca7931e286ba6bf9ba6a168db /gdb
parent79732189eab6d6b62f90de4836693c0590fd5d12 (diff)
downloadgdb-5f667f2da0743a684b20714b4c72da4696ff1c22.zip
gdb-5f667f2da0743a684b20714b4c72da4696ff1c22.tar.gz
gdb-5f667f2da0743a684b20714b4c72da4696ff1c22.tar.bz2
* target.c (find_default_run_target): Allow a NULL `do_mesg'
parameter. If it is NULL, don't call error. (find_default_can_async_p, find_default_is_async_p): Pass NULL as `do_mesg' parameter to find_default_run_target. If no target was found, return 0.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/target.c26
2 files changed, 28 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 075b917..e0e7d21 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-28 Pedro Alves <pedro@codesourcery.com>
+
+ * target.c (find_default_run_target): Allow a NULL `do_mesg'
+ parameter. If it is NULL, don't call error.
+ (find_default_can_async_p, find_default_is_async_p): Pass NULL as
+ `do_mesg' parameter to find_default_run_target. If no target was
+ found, return 0.
+
2008-03-28 Daniel Jacobowitz <dan@codesourcery.com>
* mips-linux-tdep.c: Update N32/N64 signal frame comments.
diff --git a/gdb/target.c b/gdb/target.c
index 7cf6cf3..7f53944 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1782,7 +1782,8 @@ The \"%s\" target does not support \"run\". Try \"help target\" or \"continue\"
execute a run or attach command without any other data. This is
used to locate the default process stratum.
- Result is always valid (error() is called for errors). */
+ If DO_MESG is not NULL, the result is always valid (error() is
+ called for errors); else, return NULL on error. */
static struct target_ops *
find_default_run_target (char *do_mesg)
@@ -1804,7 +1805,12 @@ find_default_run_target (char *do_mesg)
}
if (count != 1)
- error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
+ {
+ if (do_mesg)
+ error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
+ else
+ return NULL;
+ }
return runable;
}
@@ -1835,8 +1841,12 @@ find_default_can_async_p (void)
{
struct target_ops *t;
- t = find_default_run_target ("async");
- if (t->to_can_async_p)
+ /* This may be called before the target is pushed on the stack;
+ look for the default process stratum. If there's none, gdb isn't
+ configured with a native debugger, and target remote isn't
+ connected yet. */
+ t = find_default_run_target (NULL);
+ if (t && t->to_can_async_p)
return (t->to_can_async_p) ();
return 0;
}
@@ -1846,8 +1856,12 @@ find_default_is_async_p (void)
{
struct target_ops *t;
- t = find_default_run_target ("async");
- if (t->to_is_async_p)
+ /* This may be called before the target is pushed on the stack;
+ look for the default process stratum. If there's none, gdb isn't
+ configured with a native debugger, and target remote isn't
+ connected yet. */
+ t = find_default_run_target (NULL);
+ if (t && t->to_is_async_p)
return (t->to_is_async_p) ();
return 0;
}