Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:jeff_mahoney:crash-python:devel
gdb
0013-py-objfile-add-has_symbols-method.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0013-py-objfile-add-has_symbols-method.patch of Package gdb
From afebf172a864613b60c68cfbf06aeb99389f141c Mon Sep 17 00:00:00 2001 From: Jeff Mahoney <jeffm@suse.com> Date: Thu, 25 Apr 2019 12:49:58 -0400 Subject: [PATCH 13/17] py-objfile: add has_symbols() method When loading objfile files, it's useful to determine whether the caller needs to locate and load separate debuginfo. Inside gdb, this is keyed off of has_symbols(), so let's export that via Python. Signed-off-by: Jeff Mahoney <jeffm@suse.com> --- gdb/doc/python.texi | 5 +++++ gdb/python/py-objfile.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index b23741e751f..8d502905d27 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -4920,6 +4920,11 @@ Like @code{Objfile.lookup_global_symbol}, but searches for a global symbol with static linkage named @var{name} in this objfile. @end defun +@defun Objfile.has_symbols () +Returns @code{True} if the @code{gdb.Objfile} has a symbol table attached, +@code{False} if not. +@end defun + @node Frames In Python @subsubsection Accessing inferior stack frames from Python diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index cddb102cffd..80a3f731273 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -405,6 +405,25 @@ objfpy_is_valid (PyObject *self, PyObject *args) Py_RETURN_TRUE; } +/* Implementation of gdb.Objfile.is_has_symbols (self) -> Boolean. + Returns True if this object file has even partial symbols available. */ + +static PyObject * +objfpy_has_symbols (PyObject *self, PyObject *args) +{ + objfile_object *obj = (objfile_object *) self; + + OBJFPY_REQUIRE_VALID (obj); + + if (objfile_has_symbols (obj->objfile)) + { + Py_RETURN_TRUE; + } + + Py_RETURN_FALSE; +} + + struct objfile * objfpy_object_to_objfile(PyObject *self) { @@ -726,6 +745,9 @@ static PyMethodDef objfile_object_methods[] = { "is_valid", objfpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\ Return true if this object file is valid, false if not." }, + { "has_symbols", objfpy_has_symbols, METH_NOARGS, + "has_symbols () -> Boolean.\n\ +Return true if this object file has symbols associated with it." }, { "add_separate_debug_file", (PyCFunction) objfpy_add_separate_debug_file, METH_VARARGS | METH_KEYWORDS, -- 2.37.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor