summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2017-04-26 10:44:37 (GMT)
committerPierre-Marie de Rodat <derodat@adacore.com>2018-03-23 18:02:50 (GMT)
commit922fdb81e7fa99381226fa184f258e1647ab66eb (patch)
tree8f9dbb3e95fb804e599d193dce0f5fd07c648792 /src
parent96e74de0219c7d559d8f5706e88e30f37c2a2cf8 (diff)
downloadcv2pdb-922fdb81e7fa99381226fa184f258e1647ab66eb.zip
cv2pdb-922fdb81e7fa99381226fa184f258e1647ab66eb.tar.gz
cv2pdb-922fdb81e7fa99381226fa184f258e1647ab66eb.tar.bz2
dwarflines: fix last insn. address computation for DW_LNE_end_sequence
Diffstat (limited to 'src')
-rw-r--r--src/readDwarf.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/readDwarf.h b/src/readDwarf.h
index e2b8eed..5fba790 100644
--- a/src/readDwarf.h
+++ b/src/readDwarf.h
@@ -301,14 +301,23 @@ struct DWARF_LineState
void addLineInfo()
{
+ unsigned long addr = address;
+
+ // The DWARF standard says about end_sequence: "indicating that the current
+ // address is that of the first byte after the end of a sequence of target
+ // machine instructions". So if this is a end_sequence row, make it apply
+ // to the last byte of the current sequence.
+ if (end_sequence)
+ addr = last_addr - 1;
+
#if 0
const char* fname = (file == 0 ? file_ptr->file_name : files[file - 1].file_name);
printf("Adr:%08x Line: %5d File: %s\n", address, line, fname);
#endif
- if (address < seg_offset)
+ if (addr < seg_offset)
return;
mspdb::LineInfoEntry entry;
- entry.offset = address - seg_offset;
+ entry.offset = addr - seg_offset;
entry.line = line;
lineInfo.push_back(entry);
}