You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "source.h"
#include "value.h"
#include "python-internal.h"
#include "python.h"
return (PyObject *) self->owner;
}
+/* Attempt to get fully resolved file path for symtab. */
+
+static gdbpy_ref<>
+bploc_filepath (struct symtab *bploc_symtab)
+{
+ /* The exception is not ours to handle. We should always
+ return some string value and filename is never null. */
+ try
+ {
+ const char *full = symtab_to_fullname (bploc_symtab);
+ if (full)
+ return host_string_to_python_string (full);
+ }
+ catch (const gdb_exception &except)
+ {
+ }
+
+ return host_string_to_python_string (bploc_symtab->filename);
+}
+
/* Python function to get the source file name path and line number
where this breakpoint location was set. */
gdbpy_ref<> tup (PyTuple_New (2));
if (tup == nullptr)
return nullptr;
- /* symtab->filename is never NULL. */
- gdbpy_ref<> filename
- = host_string_to_python_string (self->bp_loc->symtab->filename);
+ gdbpy_ref<> filename = bploc_filepath (self->bp_loc->symtab);
if (filename == nullptr)
return nullptr;
auto line = gdb_py_object_from_ulongest (self->bp_loc->line_number);