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.
static PyObject *
pspy_solib_name (PyObject *o, PyObject *args)
{
- char *soname;
gdb_py_ulongest pc;
pspace_object *self = (pspace_object *) o;
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
return NULL;
- soname = solib_name_from_address (self->pspace, pc);
+ const char *soname = solib_name_from_address (self->pspace, pc);
if (soname == nullptr)
Py_RETURN_NONE;
return host_string_to_python_string (soname).release ();
breakpoints which are in shared libraries that are not currently
mapped in. */
-char *
+const char *
solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
{
struct so_list *so = NULL;
/* 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. */
if (print_what != SHORT_LOCATION
&& pc_p && (funname == NULL || sal.symtab == NULL))
{
- char *lib = solib_name_from_address (get_frame_program_space (frame),
- get_frame_pc (frame));
+ const char *lib
+ = solib_name_from_address (get_frame_program_space (frame),
+ get_frame_pc (frame));
if (lib)
{