+2009-10-01 Roland McGrath <roland@redhat.com>
+
+ * c++/line_info.cc (dwarf::source_file::name): Check for failure
+ return from dwarf_formstring.
+ (dwarf::source_file::to_string): Likewise.
+
2009-09-30 Roland McGrath <roland@redhat.com>
* c++/dwarf_tracker (dwarf_path_finder::walk::jump): New method.
const char *
dwarf::source_file::name () const
{
+ const char *result;
if (stringform (thisattr ()))
- return dwarf_formstring (thisattr ());
-
- Dwarf_Files *files;
- Dwarf_Word idx;
- xif (thisattr (), get_files (thisattr (), &files, &idx));
-
- const char *result = dwarf_filesrc (files, idx, NULL, NULL);
+ result = dwarf_formstring (thisattr ());
+ else
+ {
+ Dwarf_Files *files;
+ Dwarf_Word idx;
+ xif (thisattr (), get_files (thisattr (), &files, &idx));
+ result = dwarf_filesrc (files, idx, NULL, NULL);
+ }
xif (thisattr (), result == NULL);
return result;
}
static inline string
plain_string (const char *filename)
{
- return string ("\"") + filename + "\"";
+ string result ("\"");
+ result += filename;
+ result += "\"";
+ return result;
}
string
dwarf::source_file::to_string () const
{
if (stringform (thisattr ()))
- return plain_string (dwarf_formstring (thisattr ()));
+ {
+ const char *result = dwarf_formstring (thisattr ());
+ xif (thisattr (), result == NULL);
+ return plain_string (result);
+ }
Dwarf_Files *files;
Dwarf_Word idx;