mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 23:50:23 +02:00
dbgllvm: fix crash when generating debug info for procdef of imported struct
This commit is contained in:
parent
cf6a97c8ed
commit
067d96242c
@ -1249,31 +1249,29 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
defnumberlist.Add(def);
|
defnumberlist.Add(def);
|
||||||
|
|
||||||
{ we have to attach the debug info to the definition instruction of the
|
|
||||||
proc }
|
|
||||||
prologfileinfo:=nil;
|
|
||||||
procdeftai:=def.procstarttai;
|
|
||||||
if in_currentunit then
|
|
||||||
begin
|
|
||||||
if not assigned(procdeftai) or
|
|
||||||
(procdeftai.typ<>ait_llvmdecl) or
|
|
||||||
(taillvmdecl(procdeftai).def<>def) then
|
|
||||||
internalerror(2022022010);
|
|
||||||
end;
|
|
||||||
|
|
||||||
def.dbg_state:=dbg_state_writing;
|
def.dbg_state:=dbg_state_writing;
|
||||||
|
|
||||||
{ difference compared to other kinds of defs: the DISubProgram gets
|
{ difference compared to other kinds of defs: the DISubProgram gets
|
||||||
created directly in get_def_metatai because a typedef for a
|
created directly in get_def_metatai because a typedef for a
|
||||||
DISubProgram does not make sense and is not supported by LLVM ->
|
DISubProgram does not make sense and is not supported by LLVM ->
|
||||||
don't set the implementation of the metadata def here and just use
|
don't set the implementation of the metadata def here and just use
|
||||||
the regular node }
|
the regular node }
|
||||||
dinode:=def_meta_node(def);
|
dinode:=def_meta_node(def);
|
||||||
|
|
||||||
|
{ we have to attach the debug info to the definition instruction of the
|
||||||
|
proc }
|
||||||
|
prologfileinfo:=nil;
|
||||||
|
procdeftai:=nil;
|
||||||
|
if in_currentunit then
|
||||||
|
begin
|
||||||
|
procdeftai:=def.procstarttai;
|
||||||
|
if (procdeftai.typ<>ait_llvmdecl) or
|
||||||
|
(taillvmdecl(procdeftai).def<>def) then
|
||||||
|
internalerror(2022022010);
|
||||||
taillvmdecl(procdeftai).addinsmetadata(tai_llvmmetadatareferenceoperand.createreferenceto('dbg',dinode));
|
taillvmdecl(procdeftai).addinsmetadata(tai_llvmmetadatareferenceoperand.createreferenceto('dbg',dinode));
|
||||||
|
end;
|
||||||
|
|
||||||
dinode.addstring('name',symdebugname(def.procsym));
|
dinode.addstring('name',symdebugname(def.procsym));
|
||||||
try_add_file_metaref(dinode,def.fileinfo,true);
|
try_add_file_metaref(dinode,def.fileinfo,true);
|
||||||
if assigned(prologfileinfo) then
|
|
||||||
dinode.addint64('scopeLine',prologfileinfo^.line);
|
|
||||||
dispflags:=getdispflags(in_currentunit);
|
dispflags:=getdispflags(in_currentunit);
|
||||||
if dispflags<>'' then
|
if dispflags<>'' then
|
||||||
dinode.addenum('spFlags',dispflags);
|
dinode.addenum('spFlags',dispflags);
|
||||||
|
Loading…
Reference in New Issue
Block a user