Skip to content

Commit

Permalink
Merge pull request #7 from rollbar/diegov/fix_debug_line_match
Browse files Browse the repository at this point in the history
Fix debug line matching.
  • Loading branch information
diegov committed Jun 22, 2023
2 parents ec710ff + 2d64950 commit f9b7a30
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
35 changes: 22 additions & 13 deletions atorsl/src/symbolicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,31 @@ impl DwarfExt for Dwarf<'_> {
) -> Result<SourceLoc, Error> {
let mut source_locs = Vec::default();

let mut prev_row: Option<LineRow> = None;
while let Some((header, line_row)) = line_rows.next_row()? {
if line_row.end_sequence() || line_row.address() != addr {
continue;
if let Some(prev_row_value) = prev_row {
let previous_match = prev_row_value.address() <= addr && addr < line_row.address();

if previous_match {
source_locs.push(SourceLoc {
file: self.line_row_file(&prev_row_value, header, unit)?,
line: prev_row_value
.line()
.map(|line| line.get())
.unwrap_or_default(),
col: match prev_row_value.column() {
ColumnType::LeftEdge => 0,
ColumnType::Column(col) => col.get(),
},
});
}
}

source_locs.push(SourceLoc {
file: self.line_row_file(line_row, header, unit)?,
line: line_row
.line()
.map(|line| line.get())
.unwrap_or_default(),
col: match line_row.column() {
ColumnType::LeftEdge => 0,
ColumnType::Column(col) => col.get(),
},
});
prev_row = Some(line_row.to_owned());

if line_row.end_sequence() {
prev_row = None;
}
}

source_locs
Expand Down
4 changes: 2 additions & 2 deletions fixtures/test_symr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11643,11 +11643,11 @@ _DATA__TtC12Rollbar_Demo11AppDelegate (in test.dwarf) + 0

full type metadata for AppDelegate (in test.dwarf) + 0

type metadata for AppDelegate (in test.dwarf) + 0
OBJC_CLASS_$__TtC12Rollbar_Demo11AppDelegate (in test.dwarf) + 0

type metadata for AppDelegate (in test.dwarf) + 0

OBJC_CLASS_$__TtC12Rollbar_Demo11AppDelegate (in test.dwarf) + 0
type metadata for AppDelegate (in test.dwarf) + 0

OBJC_METACLASS_$_RollbarAppLanguageUtil (in test.dwarf) + 0

Expand Down

0 comments on commit f9b7a30

Please sign in to comment.