WIP: debugging

This commit is contained in:
rand00 2021-12-14 13:59:35 +01:00 committed by Reynir Björnsson
parent 462bbf5942
commit d247846e35

View file

@ -184,26 +184,30 @@ let add_routes datadir =
in in
let job_build_treemap req = let job_build_treemap req =
Log.info (fun m -> m ">>>>>>>>>> entering job_build_treemap");
let _job_name = Dream.param "job" req let _job_name = Dream.param "job" req
and build = Dream.param "build" req in and build = Dream.param "build" req in
get_uuid build >>= fun uuid -> get_uuid build >>= fun uuid ->
(Dream.sql req (Model.build uuid) >>= fun (id, _build) -> (
Dream.sql req (Model.build_artifacts id) >>= fun binaries -> Dream.sql req (Model.build uuid) >>= fun (id, _build) ->
Model.not_found ( Dream.sql req (Model.build_artifacts id) >>= fun binaries ->
List.find_map (fun f -> Model.not_found (
if not @@ Fpath.has_ext "debug" f.Builder_db.filepath then None List.find_map (fun f ->
else Some (f, binaries) if not @@ Fpath.has_ext "debug" f.Builder_db.filepath then None
) binaries else Some (f, binaries)
)) ) binaries
))
|> if_error "Error getting job build" |> if_error "Error getting job build"
~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e)) ~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e))
>>= fun (debug_binary, binaries) -> >>= fun (debug_binary, binaries) ->
Log.info (fun m -> m ">>>>>>>>>> debug-binary bound");
let binary_name = Fpath.rem_ext debug_binary.Builder_db.filepath in let binary_name = Fpath.rem_ext debug_binary.Builder_db.filepath in
List.find_opt (fun f -> Fpath.equal f.Builder_db.filepath binary_name) binaries List.find_opt (fun f -> Fpath.equal f.Builder_db.filepath binary_name) binaries
|> Model.not_found |> Model.not_found
|> if_error "Error getting job build" |> if_error "Error getting job build"
~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e)) ~log:(fun e -> Log.warn (fun m -> m "Error getting job build: %a" pp_error e))
>>= fun binary -> >>= fun binary ->
Log.info (fun m -> m ">>>>>>>>>> binary bound");
let binary_size = binary.Builder_db.size in let binary_size = binary.Builder_db.size in
let datadir = Dream.global datadir_global req in let datadir = Dream.global datadir_global req in
let path = Fpath.(datadir // debug_binary.Builder_db.localpath) in let path = Fpath.(datadir // debug_binary.Builder_db.localpath) in
@ -215,6 +219,7 @@ let add_routes datadir =
~log:(fun _ -> Log.warn (fun m -> ~log:(fun _ -> Log.warn (fun m ->
m "Error reading ELF file %a" Fpath.pp path)) m "Error reading ELF file %a" Fpath.pp path))
>>= fun infos -> >>= fun infos ->
Log.info (fun m -> m ">>>>>>>>>> infos bound");
let svg_html = let svg_html =
infos infos
|> Info.import |> Info.import
@ -228,6 +233,7 @@ let add_routes datadir =
* |> Fmt.to_to_string (Tyxml.Svg.pp ()) *) * |> Fmt.to_to_string (Tyxml.Svg.pp ()) *)
in in
(* Lwt_result.ok (dream_svg svg) *) (* Lwt_result.ok (dream_svg svg) *)
Log.info (fun m -> m ">>>>>>>>>> returning svg_html");
Lwt_result.ok (Dream.html svg_html) Lwt_result.ok (Dream.html svg_html)
in in