aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/doc/ChangeLog3
-rw-r--r--gdb/doc/gdb.texinfo6
-rw-r--r--gdb/linux-nat.c39
-rw-r--r--gdb/osdata.c14
5 files changed, 64 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fd43553..b8cd0f8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2010-06-18 Stan Shebs <stan@codesourcery.com>
+ * osdata.c (get_osdata): Warn separately if target does not report
+ type list.
+ (info_osdata_command): Allow empty type, report error if target
+ does not return available types of OS data.
+ * linux-nat.c (linux_nat_xfer_osdata): Report list of OS data
+ types if no annex supplied.
+
* thread.c (thread_id_make_value): Make a value representing the
current thread.
(_initialize_thread): Create $_thread.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index e853346..b93e4c8 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,8 @@
2010-06-18 Stan Shebs <stan@codesourcery.com>
+ * gdb.texinfo (Operating System Auxiliary Information): Describe
+ "info os" when no arguments given.
+
* gdb.texinfo (Debugging Programs with Multiple Threads): Describe
$_thread.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8c19696..f361451 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -8519,6 +8519,12 @@ this functionality depends on the remote stub's support of the
@samp{qXfer:osdata:read} packet, see @ref{qXfer osdata read}.
@table @code
+@kindex info os
+@item info os
+List the types of OS information available for the target. If the
+target does not return a list of possible types, this command will
+report an error.
+
@kindex info os processes
@item info os processes
Display the list of processes on the target. For each process,
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 43370f0..93ba8e2 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4948,6 +4948,45 @@ linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
gdb_assert (object == TARGET_OBJECT_OSDATA);
+ if (!annex)
+ {
+ if (offset == 0)
+ {
+ if (len_avail != -1 && len_avail != 0)
+ obstack_free (&obstack, NULL);
+ len_avail = 0;
+ buf = NULL;
+ obstack_init (&obstack);
+ obstack_grow_str (&obstack, "<osdata type=\"types\">\n");
+
+ obstack_xml_printf (
+ &obstack,
+ "<item>"
+ "<column name=\"Type\">processes</column>"
+ "<column name=\"Description\">Listing of all processes</column>"
+ "</item>");
+
+ obstack_grow_str0 (&obstack, "</osdata>\n");
+ buf = obstack_finish (&obstack);
+ len_avail = strlen (buf);
+ }
+
+ if (offset >= len_avail)
+ {
+ /* Done. Get rid of the obstack. */
+ obstack_free (&obstack, NULL);
+ buf = NULL;
+ len_avail = 0;
+ return 0;
+ }
+
+ if (len > len_avail - offset)
+ len = len_avail - offset;
+ memcpy (readbuf, buf + offset, len);
+
+ return len;
+ }
+
if (strcmp (annex, "processes") != 0)
return 0;
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 3440b4e..76143bf 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -256,7 +256,12 @@ get_osdata (const char *type)
struct cleanup *old_chain = make_cleanup (xfree, xml);
if (xml[0] == '\0')
- warning (_("Empty data returned by target. Wrong osdata type?"));
+ {
+ if (type)
+ warning (_("Empty data returned by target. Wrong osdata type?"));
+ else
+ warning (_("Empty type list returned by target. No type data?"));
+ }
else
osdata = osdata_parse (xml);
@@ -294,15 +299,14 @@ info_osdata_command (char *type, int from_tty)
int ncols;
int nprocs;
- if (type == 0)
- /* TODO: No type could mean "list availables types". */
- error (_("Argument required."));
-
osdata = get_osdata (type);
old_chain = make_cleanup_osdata_free (osdata);
nprocs = VEC_length (osdata_item_s, osdata->items);
+ if (!type && nprocs == 0)
+ error (_("Available types of OS data not reported."));
+
last = VEC_last (osdata_item_s, osdata->items);
if (last && last->columns)
ncols = VEC_length (osdata_column_s, last->columns);