Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--agent/tcf/services/linenumbers_elf.c4
-rw-r--r--tests/test-dwarf/tcf/backend/backend.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/agent/tcf/services/linenumbers_elf.c b/agent/tcf/services/linenumbers_elf.c
index 22f1714d..89e9468e 100644
--- a/agent/tcf/services/linenumbers_elf.c
+++ b/agent/tcf/services/linenumbers_elf.c
@@ -242,7 +242,7 @@ static void unit_line_to_address(Context * ctx, MemoryRegion * mem, CompUnit * u
LineNumbersState * prev = unit->mStatesIndex[k - 1];
if (prev->mFile != state->mFile) break;
if (prev->mLine != state->mLine) break;
- if (prev->mColumn != state->mColumn) break;
+ if (column && prev->mColumn != state->mColumn) break;
state = prev;
k--;
}
@@ -251,7 +251,7 @@ static void unit_line_to_address(Context * ctx, MemoryRegion * mem, CompUnit * u
ContextAddress addr = elf_run_time_address_in_region(ctx, mem, unit->mFile, sec, state->mAddress);
if (errno == 0) {
LineNumbersState * code_next = get_next_in_code(unit, state);
- if (code_next != NULL) {
+ if (code_next != NULL && state->mAddress < code_next->mAddress) {
LineNumbersState * text_next = get_next_in_text(unit, state);
U4_T next_line = text_next ? text_next->mLine : state->mLine + 1;
U4_T next_column = text_next ? text_next->mColumn : 0;
diff --git a/tests/test-dwarf/tcf/backend/backend.c b/tests/test-dwarf/tcf/backend/backend.c
index fb7df57b..efe25df2 100644
--- a/tests/test-dwarf/tcf/backend/backend.c
+++ b/tests/test-dwarf/tcf/backend/backend.c
@@ -1963,7 +1963,6 @@ static void next_region(void) {
}
area_cnt = 0;
- line_area_ok = 0;
if (address_to_line(elf_ctx, pc, pc + 1, addr_to_line_callback, NULL) < 0) {
error("address_to_line");
}
@@ -1980,6 +1979,7 @@ static void next_region(void) {
for (i = 0; i < area_cnt; i++) {
CodeArea area = area_buf[i];
char * elf_file_name = tmp_strdup(area.file);
+ line_area_ok = 0;
if (area.start_address > pc || area.end_address <= pc) {
errno = set_errno(ERR_OTHER, "Invalid line area address");
error("address_to_line");

Back to the top