diff options
author | Tristan Gingold | 2015-11-18 21:45:45 +0100 |
---|---|---|
committer | Tristan Gingold | 2015-11-19 05:47:59 +0100 |
commit | 92b0b82ea32982b94eb8bf19a0b498d92053fffe (patch) | |
tree | 70b04f103d145dc01d31870e50b5e6a654dc20e0 /src/ortho/mcode/binary_file-memory.adb | |
parent | ff4bc5fb13a997a1d00596578b6d7deb5c0b0da6 (diff) | |
download | ghdl-92b0b82ea32982b94eb8bf19a0b498d92053fffe.tar.gz ghdl-92b0b82ea32982b94eb8bf19a0b498d92053fffe.tar.bz2 ghdl-92b0b82ea32982b94eb8bf19a0b498d92053fffe.zip |
Add symbolizer (for mcode).
Display a backtrace in case of failed check or assert failure.
Diffstat (limited to 'src/ortho/mcode/binary_file-memory.adb')
-rw-r--r-- | src/ortho/mcode/binary_file-memory.adb | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/ortho/mcode/binary_file-memory.adb b/src/ortho/mcode/binary_file-memory.adb index a37af9c..9797cd6 100644 --- a/src/ortho/mcode/binary_file-memory.adb +++ b/src/ortho/mcode/binary_file-memory.adb @@ -16,17 +16,12 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Ada.Text_IO; use Ada.Text_IO; -with Ada.Unchecked_Conversion; package body Binary_File.Memory is -- Absolute section. Sect_Abs : Section_Acc; - function To_Pc_Type is new Ada.Unchecked_Conversion - (Source => System.Address, Target => Pc_Type); - - procedure Set_Symbol_Address (Sym : Symbol; Addr : System.Address) - is + procedure Set_Symbol_Address (Sym : Symbol; Addr : System.Address) is begin Set_Symbol_Value (Sym, To_Pc_Type (Addr)); Set_Scope (Sym, Sym_Global); @@ -48,20 +43,21 @@ package body Binary_File.Memory is -- Relocate section in memory. Sect := Section_Chain; while Sect /= null loop + -- Allocate memory if needed (eg: .bss) if Sect.Data = null then if Sect.Pc > 0 then Resize (Sect, Sect.Pc); Sect.Data (0 .. Sect.Pc - 1) := (others => 0); - else - null; - --Sect.Data := new Byte_Array (1 .. 0); end if; end if; - if Sect.Data_Max > 0 + + -- Set virtual address. + if Sect.Pc > 0 and (Sect /= Sect_Abs and Sect.Flags /= Section_Debug) then Sect.Vaddr := To_Pc_Type (Sect.Data (0)'Address); end if; + Sect := Sect.Next; end loop; @@ -98,4 +94,14 @@ package body Binary_File.Memory is Sect := Sect.Next; end loop; end Write_Memory_Relocate; + + function Get_Section_Base (Sect : Section_Acc) return System.Address is + begin + return Sect.Data (0)'Address; + end Get_Section_Base; + + function Get_Section_Size (Sect : Section_Acc) return Pc_Type is + begin + return Sect.Pc; + end Get_Section_Size; end Binary_File.Memory; |