summaryrefslogtreecommitdiff
path: root/rtl
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-08 19:50:40 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2021-04-08 19:50:40 +0000
commit623761346df68474a61a072872f0a914ccb41dd0 (patch)
tree342f345f62cab9b0d09c728bf15529e6e64021c1 /rtl
parentf2c6399fb289d61af6f826d122514b847518da0b (diff)
downloadfpc-623761346df68474a61a072872f0a914ccb41dd0.tar.gz
* handle case where the first instruction with line information is looked up
o this should be handled better. The common way is looking up address - 1, but that doesn't seem to work here. git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@49142 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl')
-rw-r--r--rtl/inc/lnfodwrf.pp20
1 files changed, 15 insertions, 5 deletions
diff --git a/rtl/inc/lnfodwrf.pp b/rtl/inc/lnfodwrf.pp
index d6ed1b4b75..ec2b73dbf2 100644
--- a/rtl/inc/lnfodwrf.pp
+++ b/rtl/inc/lnfodwrf.pp
@@ -896,7 +896,10 @@ begin
end;
{ when we have found the address we need to return the previous
- line because that contains the call instruction }
+ line because that contains the call instruction
+ Note that there may not be any call instruction, because this may
+ be the actual instruction that crashed, and it may be on the first
+ line of the function }
if (state.segment > segment) or
((state.segment = segment) and
(state.address >= addr)) then
@@ -918,10 +921,17 @@ begin
opcode := ReadNext();
end;
- if (found) then begin
- line := prev_line;
- source := GetFullFilename(file_names, include_directories, prev_file);
- end;
+ if (found) then
+ begin
+ { can happen if the crash happens on the first instruction with line info }
+ if prev_line = 0 then
+ begin
+ prev_line := state.line;
+ prev_file := state.file_id;
+ end;
+ line := prev_line;
+ source := GetFullFilename(file_names, include_directories, prev_file);
+ end;
end;