Constify solib_name_from_address
I noticed that solib_name_from_address returned a non-const string, but it's more appropriate to return const. This patch implements this. Tested by rebuilding.
This commit is contained in:
parent
b11f3dbb88
commit
6d08aed3c9
4 changed files with 6 additions and 6 deletions
|
@ -351,7 +351,6 @@ pspy_get_objfiles (PyObject *self_, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pspy_solib_name (PyObject *o, PyObject *args)
|
pspy_solib_name (PyObject *o, PyObject *args)
|
||||||
{
|
{
|
||||||
char *soname;
|
|
||||||
gdb_py_ulongest pc;
|
gdb_py_ulongest pc;
|
||||||
pspace_object *self = (pspace_object *) o;
|
pspace_object *self = (pspace_object *) o;
|
||||||
|
|
||||||
|
@ -360,7 +359,7 @@ pspy_solib_name (PyObject *o, PyObject *args)
|
||||||
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
|
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
soname = solib_name_from_address (self->pspace, pc);
|
const char *soname = solib_name_from_address (self->pspace, pc);
|
||||||
if (soname == nullptr)
|
if (soname == nullptr)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
return host_string_to_python_string (soname).release ();
|
return host_string_to_python_string (soname).release ();
|
||||||
|
|
|
@ -1225,7 +1225,7 @@ solib_contains_address_p (const struct so_list *const solib,
|
||||||
breakpoints which are in shared libraries that are not currently
|
breakpoints which are in shared libraries that are not currently
|
||||||
mapped in. */
|
mapped in. */
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
|
solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
|
||||||
{
|
{
|
||||||
struct so_list *so = NULL;
|
struct so_list *so = NULL;
|
||||||
|
|
|
@ -48,7 +48,7 @@ extern void solib_create_inferior_hook (int from_tty);
|
||||||
|
|
||||||
/* If ADDR lies in a shared library, return its name. */
|
/* If ADDR lies in a shared library, return its name. */
|
||||||
|
|
||||||
extern char *solib_name_from_address (struct program_space *, CORE_ADDR);
|
extern const char *solib_name_from_address (struct program_space *, CORE_ADDR);
|
||||||
|
|
||||||
/* Return true if ADDR lies within SOLIB. */
|
/* Return true if ADDR lies within SOLIB. */
|
||||||
|
|
||||||
|
|
|
@ -1427,8 +1427,9 @@ print_frame (const frame_print_options &fp_opts,
|
||||||
if (print_what != SHORT_LOCATION
|
if (print_what != SHORT_LOCATION
|
||||||
&& pc_p && (funname == NULL || sal.symtab == NULL))
|
&& pc_p && (funname == NULL || sal.symtab == NULL))
|
||||||
{
|
{
|
||||||
char *lib = solib_name_from_address (get_frame_program_space (frame),
|
const char *lib
|
||||||
get_frame_pc (frame));
|
= solib_name_from_address (get_frame_program_space (frame),
|
||||||
|
get_frame_pc (frame));
|
||||||
|
|
||||||
if (lib)
|
if (lib)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue