{
mod->hdrOffset = dwrCUs->size ();
DwrLineRegs *lineReg = dwrCU->get_dwrLineReg ();
- dwrCU->srcFiles = new Vector<SourceFile *> (VecSize (lineReg->file_names));
- for (long i = 0, sz = VecSize (lineReg->file_names); i < sz; i++)
+ if (lineReg != NULL)
{
- char *fname = lineReg->getPath (i + 1);
- SourceFile *sf = mod->findSource (fname, true);
- dwrCU->srcFiles->append (sf);
+ dwrCU->srcFiles = new Vector<SourceFile *> (VecSize (lineReg->file_names));
+ for (long i = 0, sz = VecSize (lineReg->file_names); i < sz; i++)
+ {
+ char *fname = lineReg->getPath (i + 1);
+ SourceFile *sf = mod->findSource (fname, true);
+ dwrCU->srcFiles->append (sf);
+ }
}
Dwarf_cnt ctx;
if (lineno > 0)
{
func->setLineFirst (lineno);
- if (dwrLineReg == NULL)
- dwrLineReg = new DwrLineRegs (new DwrSec (dwarf->debug_lineSec,
- stmt_list_offset), comp_dir);
int fileno = ((int) Dwarf_data (DW_AT_decl_file)) - 1;
SourceFile *sf = ((fileno >= 0) && (fileno < VecSize (srcFiles))) ? srcFiles->get (fileno)
: module->getMainSrc ();
#include "DbeArray.h"
#include "DbeSession.h"
+#define NO_STMT_LIST ((uint64_t) -1)
#define CASE_S(x) case x: s = (char *) #x; break
static char *
if (*dir != '/')
{ // not absolute
char *s = include_directories->fetch (0);
- sb.append (s);
- sb.append ('/');
+ if (s != NULL && *s != 0)
+ {
+ sb.append (s);
+ sb.append ('/');
+ }
}
sb.append (dir);
sb.append ('/');
abbrevTable = NULL;
dwrInlinedSubrs = NULL;
srcFiles = NULL;
- stmt_list_offset = 0;
+ stmt_list_offset = NO_STMT_LIST;
dwrLineReg = NULL;
isMemop = false;
isGNU = false;
char *name = Dwarf_string (DW_AT_name);
if (name == NULL)
name = NTXT ("UnnamedUnit");
- stmt_list_offset = Dwarf_data (DW_AT_stmt_list);
+ int64_t v;
+ if (read_data_attr(DW_AT_stmt_list, &v) == DW_DLV_OK)
+ stmt_list_offset = v;
comp_dir = dbe_strdup (Dwarf_string (DW_AT_comp_dir));
char *dir_name = comp_dir ? StrChr (comp_dir, ':') : NULL;
char *orig_name = Dwarf_string (DW_AT_SUN_original_name);
Stabs::is_fortran (mod->lang_code));
}
}
+ if (lineReg == NULL)
+ return;
Vector<DwrLine *> *lines = lineReg->get_lines ();
Include *includes = new Include;
for (long i = 0, sz = VecSize (lines); i < sz; i++)
{
DwrLine *dwrLine = lines->get (i);
- char *filename = dwrLineReg->getPath (dwrLine->file);
+ char *filename = lineReg->getPath (dwrLine->file);
if (filename == NULL)
continue;
uint64_t pc = dwrLine->address;
DwrLineRegs *
DwrCU::get_dwrLineReg ()
{
- if (dwrLineReg == NULL)
+ if (dwrLineReg == NULL && stmt_list_offset != NO_STMT_LIST)
dwrLineReg = new DwrLineRegs (new DwrSec (dwarf->debug_lineSec,
stmt_list_offset), comp_dir);
return dwrLineReg;