From aac46663f0e11258cae91a6ee6ebee00443f1904 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Mon, 13 Feb 2023 14:30:25 -0800 Subject: [PATCH] Sort debuginfo tuples by starting address, and detect overlapping ranges --- src/ir/debug.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ir/debug.rs b/src/ir/debug.rs index 7568243..2589d97 100644 --- a/src/ir/debug.rs +++ b/src/ir/debug.rs @@ -65,10 +65,16 @@ impl DebugMap { let loc = debug.intern_loc(file, loc.line.unwrap_or(0), loc.column.unwrap_or(0)); tuples.push((start as u32, end as u32, loc)); } + tuples.sort(); println!("tuples:"); - for &(start, end, loc) in &tuples { - println!(" {:x} - {:x}: {}", start, end, loc); + let mut last = 0; + for &(start, len, loc) in &tuples { + if start < last { + println!(" WARNING: OVERLAP"); + } + last = start + len; + println!(" {:x} - {:x}: {}", start, start + len, loc); } println!("files: {:?}", debug.source_files); println!("locs: {:?}", debug.source_locs);