package mopsa
MOPSA: A Modular and Open Platform for Static Analysis using Abstract Interpretation
Install
Dune Dependency
Authors
Maintainers
Sources
mopsa-analyzer-v1.1.tar.gz
md5=fdee20e988343751de440b4f6b67c0f4
sha512=f5cbf1328785d3f5ce40155dada2d95e5de5cce4f084ea30cfb04d1ab10cc9403a26cfb3fa55d0f9da72244482130fdb89c286a9aed0d640bba46b7c00e09500
doc/src/interactive/breakpoint.ml.html
Source file breakpoint.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
(****************************************************************************) (* *) (* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *) (* *) (* Copyright (C) 2017-2021 The MOPSA Project. *) (* *) (* This program is free software: you can redistribute it and/or modify *) (* it under the terms of the GNU Lesser General Public License as published *) (* by the Free Software Foundation, either version 3 of the License, or *) (* (at your option) any later version. *) (* *) (* This program is distributed in the hope that it will be useful, *) (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) (* GNU Lesser General Public License for more details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this program. If not, see <http://www.gnu.org/licenses/>. *) (* *) (****************************************************************************) (** Breakpoints for the interactive mode *) open Mopsa_utils open Core.All open Format open Location (** Breakpoint *) type breakpoint = | B_function of string (** function *) (** Break at the beginning of a function *) | B_line of string (** file *) * int (** line *) (** Break at line *) | B_named of string (** Named breakpoint *) | B_alarm (** Break on new alarms *) (** Compare two breakpoints *) let compare_breakpoint b1 b2 : int = match b1, b2 with | B_function(f1), B_function(f2) -> compare f1 f2 | B_line(file1,line1), B_line(file2,line2) -> Compare.pair compare compare (file1,line1) (file2,line2) | B_named b1, B_named b2 -> String.compare b1 b2 | B_alarm, B_alarm -> 0 | _ -> compare b1 b2 (** Print a breakpoint *) let pp_breakpoint fmt = function | B_function f -> Format.fprintf fmt "%s" f | B_line(file,line) -> Format.fprintf fmt "%s:%d" file line | B_named b -> Format.fprintf fmt "@%s" b | B_alarm -> Format.pp_print_string fmt "#alarm" (** Set of breakpoints *) module BreakpointSet = SetExt.Make(struct type t = breakpoint let compare = compare_breakpoint end) (** Print a set of breakpoints *) let pp_breakpoint_set fmt bs = Format.fprintf fmt "@[<v>%a@]" (Format.pp_print_list ~pp_sep:(fun fmt () -> Format.fprintf fmt "@,") pp_breakpoint) (BreakpointSet.elements bs) (** Exception raised when parsing an invalid breakpoint string *) exception Invalid_breakpoint_syntax (** Parse a breakpoint string *) let parse_breakpoint default_file (s:string) : breakpoint = if Str.string_match (Str.regexp "@\\(.+\\)$") s 0 then let name = Str.matched_group 1 s in B_named name else if Str.string_match (Str.regexp "#alarm$") s 0 || Str.string_match (Str.regexp "#a$") s 0 then B_alarm else if Str.string_match (Str.regexp "\\([0-9]+\\)$") s 0 then let file = default_file in let line = int_of_string (Str.matched_group 1 s) in B_line(file, line) else if Str.string_match (Str.regexp "\\(.+\\):\\([0-9]+\\)$") s 0 then let file = Str.matched_group 1 s in let line = int_of_string (Str.matched_group 2 s) in B_line(file, line) else if Str.string_match (Str.regexp "\\([^0-9].*\\)$") s 0 then let func = Str.matched_group 1 s in B_function(func) else raise Invalid_breakpoint_syntax (** Set of active breakpoints *) let breakpoints = ref BreakpointSet.empty
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>