Skip to content

Commit

Permalink
more logging improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
trou committed Dec 15, 2021
1 parent 6d29cf7 commit b0e8108
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ocaml/src/fixpoint/forward.ml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ module Make(D: Domain.T)(Cfa: Cfa.T with type domain = D.t)(Stubs: Stubs.T with
| [] -> raise (Exceptions.Empty "no return address can be computed")
| _l -> raise (Exceptions.Too_many_concrete_elements "multiple return addresses")
in
L.analysis (fun p -> p "returning from stub to %s" (Data.Address.to_string a));
L.info2 (fun p -> p "returning from stub to %s" (Data.Address.to_string a));
v.Cfa.State.ip <- a;
Log.Trace.trace a (fun p -> p "%s"
(Asm.string_of_stmts [ Asm.Jmp(R ret_addr_exp) ] true));
Expand Down
6 changes: 1 addition & 5 deletions ocaml/src/fixpoint/stubs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,9 @@ module Make(D: Domain.T) = struct

let puts (_ip: Data.Address.t) _ d ret args =
let str = Asm.Lval (args 0) in
L.info (fun p -> p "puts output:");
let len, d' = D.print_until d str (Asm.Const (Data.Word.of_int Z.zero 8)) 8 10000 true None in
let d', taint = D.set ret (Asm.Const (Data.Word.of_int (Z.of_int len) !Config.operand_sz)) d' in
L.info (fun p -> p "--- end of puts--");
Log.Stdout.stdout (fun p -> p "\n");
d', taint


Expand All @@ -374,11 +373,9 @@ module Make(D: Domain.T) = struct
if fd = 1 then
let buf = Asm.Lval (args 1) in
try
L.info (fun p -> p "write(1) output:");
let char_nb = Z.to_int (D.value_of_exp d (Asm.Lval (args 2))) in
let d', len = D.print_chars d buf char_nb None in
let d', taint = D.set ret (Asm.Const (Data.Word.of_int (Z.of_int len) !Config.operand_sz)) d' in
L.info (fun p -> p "--- end of write--");
d', taint
with Exceptions.Too_many_concrete_elements _ -> L.abort (fun p -> p "imprecise number of char to write")
else
Expand Down Expand Up @@ -406,7 +403,6 @@ module Make(D: Domain.T) = struct

let putchar (_ip) _ d ret args =
let str = Asm.Lval (args 0) in
L.info (fun p -> p "putchar output:");
let d' = D.print d str !Config.operand_sz in
D.set ret (Asm.Const (Data.Word.of_int Z.one !Config.operand_sz)) d'

Expand Down

0 comments on commit b0e8108

Please sign in to comment.