mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 10:48:30 +02:00
+ emit DW_OP_bregx dwarf ops for local variables and parameters, relative to BP
on i8086. This fixes Watcom Debugger not showing them right in memory models, where DS<>SS (Watcom seems to ignore the DW_AT_segment attribute for register relative variables, even though we emit it correctly :/ ) git-svn-id: trunk@39111 -
This commit is contained in:
parent
855c810c09
commit
c5fe78201c
@ -362,6 +362,8 @@ interface
|
||||
|
||||
function get_def_dwarf_labs(def:tdef): PDwarfHashSetItem;
|
||||
|
||||
function is_fbreg(reg:tregister):boolean;
|
||||
|
||||
{ Convenience version of the method below, so the compiler creates the
|
||||
tvarrec for us (must only pass one element in the last parameter). }
|
||||
procedure append_attribute(attr: tdwarf_attribute; form: tdwarf_form; const values: array of const);
|
||||
@ -1039,6 +1041,16 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDebugInfoDwarf.is_fbreg(reg: tregister): boolean;
|
||||
begin
|
||||
{$ifdef i8086}
|
||||
result:=reg=NR_BP;
|
||||
{$else i8086}
|
||||
{ always return false, because we don't emit DW_AT_frame_base attributes yet }
|
||||
result:=false;
|
||||
{$endif i8086}
|
||||
end;
|
||||
|
||||
function TDebugInfoDwarf.def_dwarf_lab(def: tdef): tasmsymbol;
|
||||
begin
|
||||
result:=get_def_dwarf_labs(def)^.lab;
|
||||
@ -2589,19 +2601,28 @@ implementation
|
||||
}
|
||||
if sym.localloc.loc<> LOC_INVALID then
|
||||
begin
|
||||
dreg:=dwarf_reg(sym.localloc.reference.base);
|
||||
if dreg<=31 then
|
||||
if is_fbreg(sym.localloc.reference.base) then
|
||||
begin
|
||||
templist.concat(tai_const.create_8bit(ord(DW_OP_breg0)+dreg));
|
||||
templist.concat(tai_const.create_8bit(ord(DW_OP_fbreg)));
|
||||
templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
||||
blocksize:=1+Lengthsleb128(sym.localloc.reference.offset+offset);
|
||||
end
|
||||
else
|
||||
begin
|
||||
templist.concat(tai_const.create_8bit(ord(DW_OP_bregx)));
|
||||
templist.concat(tai_const.create_uleb128bit(dreg));
|
||||
templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
||||
blocksize:=1+Lengthuleb128(dreg)+LengthSleb128(sym.localloc.reference.offset+offset);
|
||||
dreg:=dwarf_reg(sym.localloc.reference.base);
|
||||
if dreg<=31 then
|
||||
begin
|
||||
templist.concat(tai_const.create_8bit(ord(DW_OP_breg0)+dreg));
|
||||
templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
||||
blocksize:=1+Lengthsleb128(sym.localloc.reference.offset+offset);
|
||||
end
|
||||
else
|
||||
begin
|
||||
templist.concat(tai_const.create_8bit(ord(DW_OP_bregx)));
|
||||
templist.concat(tai_const.create_uleb128bit(dreg));
|
||||
templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset));
|
||||
blocksize:=1+Lengthuleb128(dreg)+LengthSleb128(sym.localloc.reference.offset+offset);
|
||||
end;
|
||||
end;
|
||||
{$ifdef i8086}
|
||||
segment_reg:=sym.localloc.reference.segment;
|
||||
|
Loading…
Reference in New Issue
Block a user