]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
patch ../102429401.patch
authorDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:31 +0000 (12:00 -0800)
committerDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:31 +0000 (12:00 -0800)
README.google
gdb/NEWS
gdb/doc/python.texi
gdb/python/py-objfile.c
gdb/testsuite/gdb.python/py-objfile.exp

index c4cbbb236a30340cccd4002eb2a4864126854aed..04be03c3175169bbe3f3e31327f49b8f01859908 100644 (file)
@@ -208,3 +208,17 @@ they are an ongoing maintenance burden.
 +
 +      Upstream PR libc/13097, local ref# 17474967
 +      * solib-svr4.c (svr4_read_so_list): Ignore linux-vdso64.so.1, for ppc.
+--- README.google      2015-09-05 18:02:29.000000000 -0700
++++ README.google      2015-09-05 18:13:45.000000000 -0700
++
++2015-09-05  Doug Evans  <google.com>
++
++      * NEWS: Mention gdb.Objfile.have_debug_info.
++      * python/py-objfile.c (objfpy_get_have_debug_info): New function.
++      (objfile_getset): Add "have_debug_info".
++
++      doc/
++      * python.texi (Objfiles In Python): Document Objfile.have_debug_info.
++
++      testsuite/
++      * gdb.python/py-objfile.exp: Add tests for objfile.have_debug_info.
index 26f328d2b9a60575f8bcebddab89f4b4798a6bee..83cba9e5390810ba5e297f9c1d8600154910865e 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -76,6 +76,8 @@
 
 * Python Scripting
 
+  ** gdb.Objfile objects have a new attribute "have_debug_info", which is
+     a boolean indicating if debug information for the objfile is present.
   ** gdb.Objfile objects have a new attribute "username",
      which is the name of the objfile as specified by the user,
      without, for example, resolving symlinks.
index a2df254db037a2da8343774f633be2ba4513e63a..45de2bf8a307adbb18bc112d8aff2c4f070ee895 100644 (file)
@@ -3720,6 +3720,15 @@ command-line option in @ref{Options, , Command Line Options, ld.info,
 The GNU Linker}.
 @end defvar
 
+@defvar Objfile.have_debug_info
+A boolean indicating if debug information for the objfile is present.
+Note that a program compiled without @samp{-g} may still have some debug
+information, e.g., from the @code{C} runtime.  Thus a value of @code{True}
+for this attribute does not mean that debug information is present for
+every source file in the program.  It only means that debug information
+is present for at least one source file.
+@end defvar
+
 @defvar Objfile.progspace
 The containing program space of the objfile as a @code{gdb.Progspace}
 object.  @xref{Progspaces In Python}.
index 5dc9ae65ed986a6c562ee529e339fe1e837941be..3cc510cd52ae874e82b3f1fb54012b12645f9d81 100644 (file)
@@ -161,6 +161,32 @@ objfpy_get_build_id (PyObject *self, void *closure)
   Py_RETURN_NONE;
 }
 
+/* An Objfile method which returns whether there debug information
+   has been stripped.  */
+
+static PyObject *
+objfpy_get_have_debug_info (PyObject *self, void *closure)
+{
+  objfile_object *obj = (objfile_object *) self;
+  struct objfile *objfile = obj->objfile;
+
+  if (objfile != NULL)
+    {
+      /* This uses the same test that the file readers use, e.g.,
+        elf_symfile_read, because its main purpose is to decide whether
+        separate debug info files should be fetched.
+        See elf_symfile_read.  */
+      if (!objfile_has_partial_symbols (objfile)
+         && !objfile_has_full_symbols (objfile)
+         && objfile->separate_debug_objfile == NULL
+         && objfile->separate_debug_objfile_backlink == NULL)
+       Py_RETURN_FALSE;
+      Py_RETURN_TRUE;
+    }
+
+  Py_RETURN_FALSE;
+}
+
 /* An Objfile method which returns the objfile's progspace, or None.  */
 
 static PyObject *
@@ -695,6 +721,8 @@ static PyGetSetDef objfile_getset[] =
     NULL },
   { "build_id", objfpy_get_build_id, NULL,
     "The objfile's build id, or None.", NULL },
+  { "have_debug_info", objfpy_get_have_debug_info, NULL,
+    "True if there is debug information for the objfile.", NULL },
   { "progspace", objfpy_get_progspace, NULL,
     "The objfile's progspace, or None.", NULL },
   { "pretty_printers", objfpy_get_printers, objfpy_set_printers,
index 4de20c5013259277cfeca011190377b5a9500a2e..982346a52209f1f6ba267752fb6815cdef285834 100644 (file)
@@ -61,6 +61,9 @@ if [string compare $binfile_build_id ""] {
     unsupported "build-id is not supported by the compiler"
 }
 
+gdb_test "python print (objfile.have_debug_info)" "True" \
+    "Get objfile have_debug_info"
+
 # Other lookup_objfile_by_build_id tests we can do, even if compiler doesn't
 # support them.
 gdb_test "python print (gdb.lookup_objfile (\"foo\", by_build_id=True))" \
@@ -107,6 +110,9 @@ if ![runto_main] {
 gdb_py_test_silent_cmd "python objfile = gdb.objfiles()\[0\]" \
     "Get no-debug objfile file" 1
 
+gdb_test "python print (objfile.have_debug_info)" "False" \
+    "Get no-debug objfile have_debug_info"
+
 gdb_test "python print (objfile.owner)" "None" \
     "Test owner of real objfile."