aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-10-14 15:45:21 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2016-10-14 15:45:21 +0200
commit22efd958aef1d4372a905158befa5394dec3c604 (patch)
tree42c1e6b7ad98a068231e11067ce9bae6e146b0d1 /debug
parent0a500b73fc9bd6c6752c7bf0079e2305d0040303 (diff)
downloadcompcert-kvx-22efd958aef1d4372a905158befa5394dec3c604.tar.gz
compcert-kvx-22efd958aef1d4372a905158befa5394dec3c604.zip
Refactored debugging options.
The options controlling the generation of debugging information are now moved into the Debug module. Futhermore the -gdepth options are replaced in favor of a more gcc compatible version. Bug 20193
Diffstat (limited to 'debug')
-rw-r--r--debug/DebugInit.ml38
1 files changed, 36 insertions, 2 deletions
diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml
index b3fedb00..ed22f7c2 100644
--- a/debug/DebugInit.ml
+++ b/debug/DebugInit.ml
@@ -10,7 +10,10 @@
(* *)
(* *********************************************************************)
+open Clflags
+open Commandline
open Debug
+open Driveraux
let default_debug =
{
@@ -48,7 +51,6 @@ let init_debug () =
implem :=
if Configuration.system = "diab" then
let gen = (fun a b -> Some (Dwarfgen.gen_diab_debug_info a b)) in
- Clflags.option_gdwarf := 2; (* Dwarf 2 is the only supported target *)
{default_debug with generate_debug_info = gen;
add_diab_info = DebugInformation.add_diab_info;
add_fun_addr = DebugInformation.diab_add_fun_addr;}
@@ -60,7 +62,39 @@ let init_none () =
implem := default_implem
let init () =
- if !Clflags.option_g then
+ if !option_g then
init_debug ()
else
init_none ()
+
+let gnu_debugging_help =
+" -gdwarf- Generate debug information in DWARF v2 or DWARF v3\n"
+
+let debugging_help =
+"Debugging options:\n\
+\ -g Generate debugging information\n\
+\ -g<n> Control generation of debugging information\n\
+\ (<n>=0: none, <n>=1: only-globals, <n>=2: globals + locals \n\
+\ without locations, <n>=3: full;)\n"
+^ (if gnu_system then gnu_debugging_help else "")
+
+let gnu_debugging_actions =
+ let version version () =
+ option_g:=true;
+ option_gdwarf:=version
+ in
+ [Exact "-gdwarf-2", Unit (version 2);
+ Exact "-gdwarf-3", Unit (version 3);]
+
+let debugging_actions =
+ let depth depth () =
+ option_g:=true;
+ option_gdepth := depth
+ in
+ [Exact "-g", Unit (depth 3);
+ Exact "-g0", Unset option_g;
+ Exact "-g1", Unit (depth 1);
+ Exact "-g2", Unit (depth 2);
+ Exact "-g3", Unit (depth 3);]
+ @
+ (if gnu_system then gnu_debugging_actions else [])