public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: Properly complaining when finding corrupt probes.
@ 2011-02-14 22:26 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-02-14 22:26 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  0b98e689cca2f305c85efc8ce93a369f4be9006c (commit)
      from  0685505386da12a958e2067ac9d50fa5ad9efed4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 0b98e689cca2f305c85efc8ce93a369f4be9006c
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Mon Feb 14 20:26:42 2011 -0200

    Properly complaining when finding corrupt probes.

-----------------------------------------------------------------------

Summary of changes:
 gdb/elfread.c |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

First 500 lines of diff:
diff --git a/gdb/elfread.c b/gdb/elfread.c
index a7c8d3b..346e637 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1054,9 +1054,10 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
 }
 
 static void
-handle_probe (struct sdt_note *el, struct stap_probe *ret, bfd *abfd,
-	      CORE_ADDR base)
+handle_probe (struct objfile *objfile, struct sdt_note *el,
+	      struct stap_probe *ret, CORE_ADDR base)
 {
+  bfd *abfd = objfile->obfd;
   int size = bfd_get_arch_size (abfd) / 8;
   struct gdbarch *gdbarch = get_current_arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1068,8 +1069,16 @@ handle_probe (struct sdt_note *el, struct stap_probe *ret, bfd *abfd,
 		      (unsigned long *) el->data
 		      + el->size - (unsigned long *) ret->provider);
   /* Making sure there is a name.  */
-  gdb_assert (ret->name != NULL);
-  ++ret->name;
+  if (!ret->name)
+    {
+      CORE_ADDR tmp = (CORE_ADDR) &ret->provider[0];
+
+      complaint (&symfile_complaints, _("corrupt probe when reading `%s' \
+at `%s'"),
+		 objfile->name, paddress (gdbarch, tmp));
+    }
+  else
+    ++ret->name;
 
   /* Retrieving the probe's address.  */
   ret->address = extract_typed_address ((const gdb_byte *) &el->data[0],
@@ -1086,14 +1095,25 @@ handle_probe (struct sdt_note *el, struct stap_probe *ret, bfd *abfd,
     ret->sem_addr += base - base_ref;
 
   /* Arguments.  */
-  ret->args = memchr (ret->name, '\0',
-		      (unsigned long *) el->data
-		      + el->size - (unsigned long *) ret->name);
-  gdb_assert (ret->args != NULL);
-  ++ret->args;
-  gdb_assert (memchr (ret->args, '\0', (unsigned long *) el->data
-		      + el->size - (unsigned long *) ret->name)
-	      == el->data + el->size - 1);
+  if (ret->name)
+    {
+      ret->args = memchr (ret->name, '\0',
+			  (unsigned long *) el->data
+			  + el->size - (unsigned long *) ret->name);
+
+      if (ret->args++ != NULL
+	  || memchr (ret->args, '\0', (unsigned long *) el->data
+		     + el->size - (unsigned long *) ret->name)
+	  != el->data + el->size - 1)
+	{
+	  CORE_ADDR tmp = (CORE_ADDR) &ret->name[0];
+
+	  complaint (&symfile_complaints, _("corrupt probe when reading \
+`%s' at `%s'"), objfile->name, paddress (gdbarch, tmp));
+	}
+    }
+  else
+    ret->args = NULL;
 }
 
 #define STAP_BASE_SECTION_NAME ".stapsdt.base"
@@ -1144,7 +1164,7 @@ elf_get_probes (struct objfile *objfile, int *num_probes)
   for (iter = elf_tdata (obfd)->sdt_note_head, i = 0;
        iter;
        iter = iter->next, i++)
-    handle_probe (iter, &ret[i], obfd, base);
+    handle_probe (objfile, iter, &ret[i], base);
 
   return ret;
 }


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-14 22:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 22:26 [SCM] archer-sergiodj-stap: Properly complaining when finding corrupt probes sergiodj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).