History

Fix source line assumption in sbl reader. - Statements can cross source line boundaries

arr committed 9 years ago

Commit 5ef656f1 parent 4afaca44 files · +10 −7Browse files

Showing the changes to src/asm/sbl_reader.cpp (1 of 4 files). Show all

Unified · Split

src/asm/sbl_reader.cpp+6−4
@@ -243,7 +243,7 @@ namespace · 242 unmodified lines
243243 source_ref_t src;
244244
245245 // Initialize the source with the last state
246− src.source_id = fc.last_file;
246+ src.begin_source_id = fc.last_file;
247247 src.begin_line = fc.last_line;
248248 src.end_line = fc.last_line;
249249 for (auto i = std::size_t{ 0 }; i < src_parts.size(); ++i)
@@ -274,8 +274,10 @@ namespace · 24 unmodified lines
274274 }
275275 else if (pos[j] == ':')
276276 {
277− assert((i == 0 || src.source_id == v) && "Source position should not change across statements");
278− src.source_id = v;
277+ if (i == 0)
278+ src.begin_source_id = v;
279+
280+ src.end_source_id = v;
279281 fc.last_file = v;
280282 }
281283 }
@@ -310,7 +312,7 @@ namespace · 28 unmodified lines
310312 curr_item.debug_statement = std::stoi(pc_item_parts[1]);
311313
312314 // Record the current source and line ID since those are the new default values
313− last_source = curr_item.source.source_id;
315+ last_source = curr_item.source.end_source_id;
314316 last_line = curr_item.source.end_line;
315317
316318 pc_table[i] = std::move(curr_item);