summaryrefslogtreecommitdiff
path: root/ortho/mcode
diff options
context:
space:
mode:
authorgingold2010-01-12 03:15:20 +0000
committergingold2010-01-12 03:15:20 +0000
commitfb5957a16dea47ae4021c5d4c57b980cea02ee59 (patch)
treeabdfbed5924f5be4418f74a0afe50b248e41c330 /ortho/mcode
parent8cca0b24e2c19eedecffdeec89a8a2898da1e362 (diff)
downloadghdl-fb5957a16dea47ae4021c5d4c57b980cea02ee59.tar.gz
ghdl-fb5957a16dea47ae4021c5d4c57b980cea02ee59.tar.bz2
ghdl-fb5957a16dea47ae4021c5d4c57b980cea02ee59.zip
ghdl 0.29 release.
Diffstat (limited to 'ortho/mcode')
-rw-r--r--ortho/mcode/binary_file-memory.adb4
-rw-r--r--ortho/mcode/binary_file.ads2
-rw-r--r--ortho/mcode/ortho_code-dwarf.adb22
-rw-r--r--ortho/mcode/ortho_code-dwarf.ads3
-rw-r--r--ortho/mcode/ortho_code-x86-abi.adb10
-rw-r--r--ortho/mcode/ortho_code-x86-insns.adb1
6 files changed, 33 insertions, 9 deletions
diff --git a/ortho/mcode/binary_file-memory.adb b/ortho/mcode/binary_file-memory.adb
index 4d5f740..a37af9c 100644
--- a/ortho/mcode/binary_file-memory.adb
+++ b/ortho/mcode/binary_file-memory.adb
@@ -57,7 +57,9 @@ package body Binary_File.Memory is
--Sect.Data := new Byte_Array (1 .. 0);
end if;
end if;
- if Sect.Data_Max > 0 and Sect /= Sect_Abs then
+ if Sect.Data_Max > 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;
diff --git a/ortho/mcode/binary_file.ads b/ortho/mcode/binary_file.ads
index f812926..1a2bf58 100644
--- a/ortho/mcode/binary_file.ads
+++ b/ortho/mcode/binary_file.ads
@@ -33,6 +33,7 @@ package Binary_File is
Section_Write : constant Section_Flags;
Section_Zero : constant Section_Flags;
Section_Strtab : constant Section_Flags;
+ Section_Debug : constant Section_Flags;
type Byte is new Unsigned_8;
@@ -218,6 +219,7 @@ private
Section_Write : constant Section_Flags := 2#0000_0100#;
Section_Zero : constant Section_Flags := 2#0000_1000#;
Section_Strtab : constant Section_Flags := 2#0001_0000#;
+ Section_Debug : constant Section_Flags := 2#0010_0000#;
Section_None : constant Section_Flags := 2#0000_0000#;
-- Scope of a symbol:
diff --git a/ortho/mcode/ortho_code-dwarf.adb b/ortho/mcode/ortho_code-dwarf.adb
index a82d635..14215d3 100644
--- a/ortho/mcode/ortho_code-dwarf.adb
+++ b/ortho/mcode/ortho_code-dwarf.adb
@@ -280,7 +280,7 @@ package body Ortho_Code.Dwarf is
Set_Symbol_Pc (Orig_Sym, False);
End_Sym := Create_Local_Symbol;
- Create_Section (Line1_Sect, ".debug_line-1", Section_None);
+ Create_Section (Line1_Sect, ".debug_line-1", Section_Debug);
Set_Current_Section (Line1_Sect);
-- Write Address.
@@ -291,14 +291,14 @@ package body Ortho_Code.Dwarf is
Line_Last := 1;
- Create_Section (Line_Sect, ".debug_line", Section_None);
+ Create_Section (Line_Sect, ".debug_line", Section_Debug);
Set_Section_Info (Line_Sect, null, 0, 0);
Set_Current_Section (Line_Sect);
Line_Sym := Create_Local_Symbol;
Set_Symbol_Pc (Line_Sym, False);
-- Abbrevs.
- Create_Section (Abbrev_Sect, ".debug_abbrev", Section_None);
+ Create_Section (Abbrev_Sect, ".debug_abbrev", Section_Debug);
Set_Section_Info (Abbrev_Sect, null, 0, 0);
Set_Current_Section (Abbrev_Sect);
@@ -318,7 +318,7 @@ package body Ortho_Code.Dwarf is
Abbrev_Last := 1;
-- Info.
- Create_Section (Info_Sect, ".debug_info", Section_None);
+ Create_Section (Info_Sect, ".debug_info", Section_Debug);
Set_Section_Info (Info_Sect, null, 0, 0);
Set_Current_Section (Info_Sect);
Info_Sym := Create_Local_Symbol;
@@ -340,13 +340,14 @@ package body Ortho_Code.Dwarf is
procedure Emit_Decl (Decl : O_Dnode);
+ -- Next node to be emitted.
Last_Decl : O_Dnode := O_Dnode_First;
procedure Emit_Decls_Until (Last : O_Dnode)
is
use Ortho_Code.Decls;
begin
- while Last_Decl <= Last loop
+ while Last_Decl < Last loop
Emit_Decl (Last_Decl);
Last_Decl := Get_Decl_Chain (Last_Decl);
end loop;
@@ -355,11 +356,16 @@ package body Ortho_Code.Dwarf is
procedure Finish
is
Length : Pc_Type;
+ Last : O_Dnode;
begin
Set_Symbol_Pc (End_Sym, False);
Length := Get_Current_Pc;
- Emit_Decls_Until (Decls.Get_Decl_Last);
+ Last := Decls.Get_Decl_Last;
+ Emit_Decls_Until (Last);
+ if Last_Decl <= Last then
+ Emit_Decl (Last);
+ end if;
-- Finish abbrevs.
Set_Current_Section (Abbrev_Sect);
@@ -449,7 +455,7 @@ package body Ortho_Code.Dwarf is
Patch_32 (0, Unsigned_32 (Get_Current_Pc - 4));
-- Aranges
- Create_Section (Aranges_Sect, ".debug_aranges", Section_None);
+ Create_Section (Aranges_Sect, ".debug_aranges", Section_Debug);
Set_Section_Info (Aranges_Sect, null, 0, 0);
Set_Current_Section (Aranges_Sect);
@@ -1325,6 +1331,8 @@ package body Ortho_Code.Dwarf is
procedure Emit_Subprg (Bod : O_Dnode) is
begin
Emit_Decls_Until (Bod);
+ Emit_Decl (Bod);
+ Last_Decl := Decls.Get_Decl_Chain (Bod);
end Emit_Subprg;
procedure Mark (M : out Mark_Type) is
diff --git a/ortho/mcode/ortho_code-dwarf.ads b/ortho/mcode/ortho_code-dwarf.ads
index bdd07eb..c120bcf 100644
--- a/ortho/mcode/ortho_code-dwarf.ads
+++ b/ortho/mcode/ortho_code-dwarf.ads
@@ -22,6 +22,9 @@ package Ortho_Code.Dwarf is
-- For a body.
procedure Emit_Subprg (Bod : O_Dnode);
+ -- Emit all debug info until but not including LAST.
+ procedure Emit_Decls_Until (Last : O_Dnode);
+
-- For a line in a subprogram.
procedure Set_Line_Stmt (Line : Int32);
procedure Set_Filename (Dir : String; File : String);
diff --git a/ortho/mcode/ortho_code-x86-abi.adb b/ortho/mcode/ortho_code-x86-abi.adb
index 56c5543..a915f92 100644
--- a/ortho/mcode/ortho_code-x86-abi.adb
+++ b/ortho/mcode/ortho_code-x86-abi.adb
@@ -87,7 +87,6 @@ package body Ortho_Code.X86.Abi is
Mark (Decls_Mark);
Consts.Mark (Consts_Mark);
Mark (Types_Mark);
- Dwarf.Mark (Dwarf_Mark);
end if;
end Start_Body;
@@ -114,6 +113,15 @@ package body Ortho_Code.X86.Abi is
Emits.Emit_Subprg (Subprg);
+ if Get_Decl_Depth (Subprg.D_Decl) = O_Toplevel
+ and then Flag_Debug = Debug_Dwarf
+ then
+ Dwarf.Emit_Decls_Until (Subprg.D_Body);
+ if not Debug.Flag_Debug_Keep then
+ Dwarf.Mark (Dwarf_Mark);
+ end if;
+ end if;
+
-- Recurse on nested subprograms.
Child := Subprg.First_Child;
while Child /= null loop
diff --git a/ortho/mcode/ortho_code-x86-insns.adb b/ortho/mcode/ortho_code-x86-insns.adb
index 4021a99..d3ea792 100644
--- a/ortho/mcode/ortho_code-x86-insns.adb
+++ b/ortho/mcode/ortho_code-x86-insns.adb
@@ -1799,6 +1799,7 @@ package body Ortho_Code.X86.Insns is
when R_Irm
| R_Rm
| R_Ir
+ | R_Sib
| R_Any32
| Regs_R32
| R_Any64