mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Primitive GDB support
This commit is contained in:
parent
d000cf2f13
commit
81c060d212
3 changed files with 13 additions and 8 deletions
|
|
@ -725,8 +725,9 @@ let compile cmd ((imports, infixes), p) =
|
|||
add_code (env, flag1, s1) les flag2 s2
|
||||
and compile_expr tail l env = function
|
||||
| Expr.Lambda (args, b) ->
|
||||
let env, lines = List.fold_left (fun (env, acc) name -> let env, ln = env#gen_line name in env, acc @ ln) (env, []) args in
|
||||
let env, name = env#add_lambda args b in
|
||||
env#register_call name, false, [PROTO (name, env#current_function)]
|
||||
env#register_call name, false, lines @ [PROTO (name, env#current_function)]
|
||||
|
||||
| Expr.Scope (ds, e) ->
|
||||
let env = env#push_scope in
|
||||
|
|
|
|||
14
src/X86.ml
14
src/X86.ml
|
|
@ -395,8 +395,8 @@ let compile cmd env imports code =
|
|||
env#assert_empty_stack;
|
||||
let has_closure = closure <> [] in
|
||||
let env = env#enter f nargs nlocals has_closure in
|
||||
env, [Meta "\t.cfi_startproc\n"] @
|
||||
(if has_closure then [Push edx] else []) @
|
||||
env, [Meta "\t.cfi_startproc"] @
|
||||
(if has_closure then [Push edx; Meta "\t.cfi_adjust_cfa_offset\t8"] else []) @
|
||||
(if f = cmd#topname
|
||||
then
|
||||
[Mov (M "_init", eax);
|
||||
|
|
@ -409,7 +409,9 @@ let compile cmd env imports code =
|
|||
else []
|
||||
) @
|
||||
[Push ebp;
|
||||
Meta "\t.cfi_adjust_cfa_offset\t8";
|
||||
Mov (esp, ebp);
|
||||
Meta "\t.cfi_def_cfa_register\t5";
|
||||
Binop ("-", M ("$" ^ env#lsize), esp);
|
||||
Mov (esp, edi);
|
||||
Mov (M "$filler", esi);
|
||||
|
|
@ -433,12 +435,14 @@ let compile cmd env imports code =
|
|||
Mov (x, eax); (*!!*)
|
||||
Label env#epilogue;
|
||||
Mov (ebp, esp);
|
||||
Pop ebp
|
||||
Pop ebp;
|
||||
] @
|
||||
env#rest_closure @
|
||||
(if name = "main" then [Binop ("^", eax, eax)] else []) @
|
||||
[Ret;
|
||||
Meta "\t.cfi_endproc\n";
|
||||
[Meta "\t.cfi_restore\t5";
|
||||
Meta "\t.cfi_def_cfa\t4, 4";
|
||||
Ret;
|
||||
Meta "\t.cfi_endproc";
|
||||
Meta (Printf.sprintf "\t.set\t%s,\t%d" env#lsize (env#allocated * word_size));
|
||||
Meta (Printf.sprintf "\t.set\t%s,\t%d" env#allocated_size env#allocated)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
let version = "Version 1.00, 6ed1b4443, Tue Sep 1 20:31:34 2020 +0300"
|
||||
let version = "Version 1.00, d000cf2f1, Fri Sep 4 00:25:07 2020 +0300"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue