-
Notifications
You must be signed in to change notification settings - Fork 84
Output g2html directly #1752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Output g2html directly #1752
Changes from all commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
a472283
g2html/resources: xslt based approach
kalmera 7b502d5
g2html/resources: offline fonts
kalmera d99f2a0
g2html/resources: more work on g2html
kalmera d4eda40
g2html/resources: some more work
kalmera db65b2c
g2html/resources: iframe resizing, warnings, and svg window size
kalmera 6b35d75
g2html/resources: only iframes and objects
kalmera f788e60
g2html/resources: multiple levels of iframes
kalmera b5ca604
g2html/resources: Revert 760e44a..1d23536
kalmera 33b8454
g2html/resources: reverted to use json files again
kalmera 757fcfc
g2html/resources: more work on stuff
kalmera 6b291e6
g2html/resources: Syntax highlighting added
stefanmarcik ba43f46
g2html/resources: re-ordered globals and made node style lighter
kalmera 7c46c52
g2html/resources: added more syntax highlighting
kalmera 80a7901
g2html/resources: forward the selected line to the file listing
kalmera a3debde
g2html/resources: monospaced font for code listings
kalmera 490b7a2
g2html/resources: span nodes have no value in firefox
kalmera b722c66
g2html/resources: minor improvements
kalmera dbbf775
g2html/resources: use full path for id
kalmera b6004be
g2html/resources: filter listing files that have live program points
kalmera 8c97fe4
g2html/resources: server code
kalmera c3af784
g2html/resources: warning iframes too high and animation too slow
vogler cf8af72
g2html/resources: Fix globals being mixed up between analyses
sim642 2ae9608
g2html/resources: Trim trailing whitespace in globals
sim642 b0cc2ba
g2html/resources: Fix globals analysis blocks showing empty values fo…
sim642 2c94f59
g2html/resources: Fix duplicate globals analysis blocks
sim642 fd1e3b8
g2html/resources: Add support for contexts embedded in global invariant
sim642 1556c52
g2html/resources: Fix globals uniqueness filtering
sim642 c73eef9
g2html/resources: Add end locations and synthetic flag to node locations
sim642 7f9c70a
Output most g2html results directly
sim642 4e134b8
Output g2html .dot files directly
sim642 1b6c6b5
Generate g2html graphviz files directly
sim642 d350cb9
Output minimal g2html <file> files directly
sim642 f1253e6
Fix file paths in direct g2html index
sim642 402543a
Copy g2html resources to direct g2html output
sim642 4e69fd9
Add warnings to code lines in direct g2html output
sim642 cb0cb1c
Add nodes to code lines in direct g2html output
sim642 244a4d8
Add liveness to code lines in direct g2html output
sim642 7b38ce4
Add pygmentize to direct g2html output
sim642 e9b4d94
Extract XsltResult from AnalysisResult
sim642 b1c4368
Split XsltResult modules more
sim642 beb7955
Extract write_index in direct g2html output
sim642 a96405b
Extract write_globals in direct g2html output
sim642 ac3bd04
Extract write_node in direct g2html output
sim642 aa72440
Extract write_warn in direct g2html output
sim642 4739751
Extract write_file in direct g2html output
sim642 754a0cb
Extract write_dot in direct g2html output
sim642 bedfa49
Extract cfg_task in direct g2html output
sim642 04cf00d
Extract copy_resources in direct g2html output
sim642 8bfcfeb
Remove unused <node>-s from direct g2html index
sim642 d6e2785
Use set for file2funs in direct g2html output
sim642 50200f9
Use set of fundecs for file2funs in direct g2html output
sim642 f0fc4fb
Extract write_nodes in direct g2html output
sim642 7f4f2d9
Extract write_warns in direct g2html output
sim642 b814daf
Extract write_files in direct g2html output
sim642 52634e4
Extract write_dots_cfgs in direct g2html output
sim642 e1ee2f2
Extract output_g2html in direct g2html output
sim642 ee8a726
Generalize path handling in direct g2html output
sim642 c8ebdb3
Extract CodeHighlighter module
sim642 9d9a786
Add fallback to CodeHighlighter
sim642 054d87c
Clean up format strings in direct g2html output
sim642 6e68cdf
Extract GobHashtbl with find_or_add_default_delayed
sim642 d442435
Simplify nested Hashtbl lookups in direct g2html output
sim642 4544dbe
Clean up printXml-s in direct g2html output
sim642 63fa7fa
Clean up CFG functions in direct g2html output
sim642 4c8ef99
Add 'xslt/' from commit 'c73eef953faf47ebe174854e276b801eaa6be932'
sim642 5906c11
Adapt xslt/file for direct g2html output with Pygments highlighting
sim642 c67f7e8
Vendor xslt for direct g2html output
sim642 069f311
Extract AnalysisResult0 module
sim642 8cff582
Separate analysis result from result output
sim642 64c3fd8
Rename analysis result output modules
sim642 dcac0a1
Rename analysis result module
sim642 4d35dc0
Update module documentation for result output
sim642 9610bcb
Merge branch 'master' into g2html-ocaml
sim642 4802f12
Fix new BatEnum semgrep warnings
sim642 63bda22
Rename direct g2html output to xslt
sim642 52137b5
Replace g2html option with g2html result
sim642 901dbcb
Move do_html_output with g2html to XsltResultOutput
sim642 478db9d
Move exp.g2html_path option handling
sim642 21c97e0
Make exp.cfgdot part of g2html output
sim642 393cc37
Don't use outfile option for g2html directory
sim642 e72289c
Remove assert false from xslt output
sim642 c5cbb4c
Make xslt output default for --html
sim642 947c30b
Merge branch 'master' into g2html-ocaml
sim642 e84a0ce
Add timing for code highlighter
sim642 e88b0e2
Remove remove old result dir in direct g2html output
sim642 31c74b2
Update TODOs in XsltResultOutput
sim642 3724cbd
Update HTML output documentatioon
sim642 8461c86
Update make setup for new HTML output
sim642 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
(** Analysis result output. *) | ||
|
||
open GoblintCil | ||
open Pretty | ||
open GobConfig | ||
open AnalysisResult | ||
|
||
module Make (Result: Result) = | ||
struct | ||
open Result | ||
|
||
let pretty () mapping = | ||
let f key st dok = | ||
dok ++ dprintf "%a ->@? @[%a@]\n" ResultNode.pretty key Range.pretty st | ||
in | ||
let content () = fold f mapping nil in | ||
let defline () = dprintf "OTHERS -> Not available\n" in | ||
dprintf "@[Mapping {\n @[%t%t@]}@]" content defline | ||
|
||
let pretty_deterministic () mapping = | ||
let bindings = | ||
to_list mapping | ||
|> List.sort [%ord: ResultNode.t * Range.t] | ||
in | ||
let f dok (key, st) = | ||
dok ++ dprintf "%a ->@? @[%a@]\n" ResultNode.pretty key Range.pretty st | ||
in | ||
let content () = List.fold_left f nil bindings in | ||
let defline () = dprintf "OTHERS -> Not available\n" in | ||
dprintf "@[Mapping {\n @[%t%t@]}@]" content defline | ||
|
||
|
||
let printJson f xs = | ||
let print_one n v = | ||
(* Not using Node.location here to have updated locations in incremental analysis. | ||
See: https://github.com/goblint/analyzer/issues/290#issuecomment-881258091. *) | ||
let loc = UpdateCil.getLoc n in | ||
BatPrintf.fprintf f "{\n\"id\": \"%s\", \"file\": \"%s\", \"line\": \"%d\", \"byte\": \"%d\", \"column\": \"%d\", \"states\": %s\n},\n" (Node.show_id n) loc.file loc.line loc.byte loc.column (Yojson.Safe.to_string (Range.to_yojson v)) | ||
in | ||
iter print_one xs | ||
|
||
|
||
let output table live gtable gtfxml (module FileCfg: MyCFG.FileCfg) = | ||
let file = FileCfg.file in | ||
let out = Messages.get_out result_name !Messages.out in | ||
match get_string "result" with | ||
| "pretty" -> ignore (fprintf out "%a\n" pretty (Lazy.force table)) | ||
| "pretty-deterministic" -> ignore (fprintf out "%a\n" pretty_deterministic (Lazy.force table)) | ||
| "fast_xml" | ||
| "g2html" -> | ||
let module Output = XsltResultOutput.Make (Result) in | ||
Output.output table live gtable gtfxml (module FileCfg) | ||
| "xslt" -> | ||
let module Output = XsltResultOutput.Make2 (Result) in | ||
Output.output table live gtable gtfxml (module FileCfg) | ||
| "json" -> | ||
let open BatPrintf in | ||
let module SH = BatHashtbl.Make (Basetype.RawStrings) in | ||
let file2funs = SH.create 100 in | ||
let funs2node = SH.create 100 in | ||
iter (fun n _ -> SH.add funs2node (Node.find_fundec n).svar.vname n) (Lazy.force table); | ||
iterGlobals file (function | ||
| GFun (fd,loc) -> SH.add file2funs loc.file fd.svar.vname | ||
| _ -> () | ||
); | ||
let p_enum p f xs = BatEnum.print ~first:"[\n " ~last:"\n]" ~sep:",\n " p f xs in (* nosemgrep: batenum-module *) | ||
let p_list p f xs = BatList.print ~first:"[\n " ~last:"\n]" ~sep:",\n " p f xs in | ||
(*let p_kv f (k,p,v) = fprintf f "\"%s\": %a" k p v in*) | ||
(*let p_obj f xs = BatList.print ~first:"{\n " ~last:"\n}" ~sep:",\n " p_kv xs in*) | ||
let p_node f n = BatPrintf.fprintf f "\"%s\"" (Node.show_id n) in | ||
let p_fun f x = fprintf f "{\n \"name\": \"%s\",\n \"nodes\": %a\n}" x (p_list p_node) (SH.find_all funs2node x) in | ||
(*let p_fun f x = p_obj f [ "name", BatString.print, x; "nodes", p_list p_node, SH.find_all funs2node x ] in*) | ||
let p_file f x = fprintf f "{\n \"name\": \"%s\",\n \"path\": \"%s\",\n \"functions\": %a\n}" (Filename.basename x) x (p_list p_fun) (SH.find_all file2funs x) in | ||
let write_file f fn = | ||
Logs.info "Writing json to temp. file: %s" fn; | ||
fprintf f "{\n \"parameters\": \"%s\",\n " GobSys.command_line; | ||
fprintf f "\"files\": %a,\n " (p_enum p_file) (SH.keys file2funs); | ||
fprintf f "\"results\": [\n %a\n]\n" printJson (Lazy.force table); | ||
(*gtfxml f gtable;*) | ||
(*printXmlWarning f ();*) | ||
fprintf f "}\n"; | ||
in | ||
let f = BatIO.output_channel out in | ||
write_file f (get_string "outfile") | ||
| "sarif" -> | ||
Logs.result "Writing Sarif to file: %s" (get_string "outfile"); | ||
Yojson.Safe.to_channel ~std:true out (Sarif.to_yojson (List.rev !Messages.Table.messages_list)); | ||
| "json-messages" -> | ||
let json = `Assoc [ | ||
("files", Preprocessor.dependencies_to_yojson ()); | ||
("messages", Messages.Table.to_yojson ()); | ||
] | ||
in | ||
Yojson.Safe.to_channel ~std:true out json | ||
| "none" -> () | ||
| s -> failwith @@ "Unsupported value for option `result`: "^s | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.