From f15e5f77cb751c2c3065e0587c790bfb598d02d6 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 15 Nov 2014 10:22:55 +0100 Subject: cchecklink: added option "-files-from" to read .sdump file names from a file or from standard input. --- checklink/Validator.ml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'checklink/Validator.ml') diff --git a/checklink/Validator.ml b/checklink/Validator.ml index baf06fca..6969409a 100644 --- a/checklink/Validator.ml +++ b/checklink/Validator.ml @@ -22,6 +22,27 @@ let set_conf_file s = | Some _ -> raise (Arg.Bad "multiple configuration files given on command line") end +let read_sdumps_from_channel ic = + try + while true do + let l = input_line ic in + if l <> "" then sdump_files := l :: !sdump_files + done + with End_of_file -> + () + +let read_sdumps_from_file f = + if f = "-" then + read_sdumps_from_channel stdin + else begin + try + let ic = open_in f in + read_sdumps_from_channel ic; + close_in ic + with Sys_error msg -> + Printf.eprintf "Error reading file: %s\n" msg; exit 2 + end + let option_disassemble = ref false let disassemble_list = ref ([]: string list) let add_disassemble s = @@ -31,12 +52,15 @@ let add_disassemble s = let options = [ (* Main options *) "-exe", Arg.String set_elf_file, - " Specify the ELF executable file to analyze"; + " Specify the ELF executable file to analyze"; "-conf", Arg.String set_conf_file, - " Specify a configuration file"; + " Specify a configuration file"; + "-files-from", Arg.String read_sdumps_from_file, + " Read names of .sdump files from the given file\n\ + \t(or from standard input if is '-')"; (* Parsing behavior *) "-relaxed", Arg.Set ELF_parsers.relaxed, - "Allows the following behaviors in the ELF parser: + "Allows the following behaviors in the ELF parser:\n\ \t* Use of a fallback heuristic to resolve symbols bootstrapped at load time"; (* Printing behavior *) "-no-exhaustive", Arg.Clear Check.exhaustivity, -- cgit