Skip to content

Commit f226161

Browse files
vincom2maurer
authored andcommitted
Initial commit to bap-traces
piqi/ocaml files for reading/writing traces TBD: test bap-lifter conceval against this Reshaped piqi to work with ocamlbuild instead of scripts Change-Id: I7f5b7683eeca36297c07973bd2788accd675d156
1 parent 1afd8aa commit f226161

21 files changed

+8678
-0
lines changed

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
3+
4+
SETUP = ocaml setup.ml
5+
6+
build: setup.data
7+
$(SETUP) -build $(BUILDFLAGS)
8+
9+
doc: setup.data build
10+
$(SETUP) -doc $(DOCFLAGS)
11+
12+
test: setup.data build
13+
$(SETUP) -test $(TESTFLAGS)
14+
15+
all:
16+
$(SETUP) -all $(ALLFLAGS)
17+
18+
install: setup.data
19+
$(SETUP) -install $(INSTALLFLAGS)
20+
21+
uninstall: setup.data
22+
$(SETUP) -uninstall $(UNINSTALLFLAGS)
23+
24+
reinstall: setup.data
25+
$(SETUP) -reinstall $(REINSTALLFLAGS)
26+
27+
clean:
28+
$(SETUP) -clean $(CLEANFLAGS)
29+
30+
distclean:
31+
$(SETUP) -distclean $(DISTCLEANFLAGS)
32+
33+
setup.data:
34+
$(SETUP) -configure $(CONFIGUREFLAGS)
35+
36+
configure:
37+
$(SETUP) -configure $(CONFIGUREFLAGS)
38+
39+
.PHONY: build doc test all install uninstall reinstall clean distclean configure
40+
41+
# OASIS_STOP
42+
PIQI=piqi
43+
OCI=ocp-indent
44+
45+
.PHONY: check
46+
check: check-piqi check-ocp-indent
47+
48+
.PHONY: check-piqi
49+
check-piqi: *.piqi
50+
for piqifile in $^; do $(PIQI) check --strict $$piqifile; done
51+
52+
.PHONY: check-ocp-indent
53+
check-ocp-indent: *.ml
54+
for mlfile in $^; do $(OCI) $$mlfile | diff - $$mlfile; done
55+
56+
.PHONY: auto-ocp-indent
57+
auto-ocp-indent: *.ml
58+
for mlfile in $^; do $(OCI) -i $$mlfile; done

_oasis

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
OASISFormat: 0.4
2+
Name: bap-types
3+
Version: 0.1
4+
Synopsis: BAP Core Types
5+
Authors: Matthew Maurer
6+
License: BSD-3-clause
7+
Plugins: META (0.4), DevFiles (0.4)
8+
9+
Library "bap-traces"
10+
Path: .
11+
BuildTools: ocamlbuild
12+
Modules: Trace_container, Frame_piqi, Frame_piqi_ext
13+
InternalModules: Arch_bfd
14+
BuildDepends: core_kernel, piqirun.pb, piqirun.ext, piqilib

_tags

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: fe79ebb5b238935cb0b98cd756ddda81)
3+
# Ignore VCS directories, you can use the same kind of rule outside
4+
# OASIS_START/STOP if you want to exclude directories that contains
5+
# useless stuff for the build process
6+
<**/.svn>: -traverse
7+
<**/.svn>: not_hygienic
8+
".bzr": -traverse
9+
".bzr": not_hygienic
10+
".hg": -traverse
11+
".hg": not_hygienic
12+
".git": -traverse
13+
".git": not_hygienic
14+
"_darcs": -traverse
15+
"_darcs": not_hygienic
16+
# Library bap-traces
17+
"bap-traces.cmxs": use_bap-traces
18+
<*.ml{,i}>: pkg_core_kernel
19+
<*.ml{,i}>: pkg_piqilib
20+
<*.ml{,i}>: pkg_piqirun.ext
21+
<*.ml{,i}>: pkg_piqirun.pb
22+
# OASIS_STOP

arch_bfd.ml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
(* File generated from arch.idl *)
2+
3+
type bfd_architecture =
4+
| Bfd_arch_unknown
5+
| Bfd_arch_obscure
6+
| Bfd_arch_m68k
7+
| Bfd_arch_vax
8+
| Bfd_arch_i960
9+
| Bfd_arch_or32
10+
| Bfd_arch_sparc
11+
| Bfd_arch_spu
12+
| Bfd_arch_mips
13+
| Bfd_arch_i386
14+
| Bfd_arch_l1om
15+
| Bfd_arch_we32k
16+
| Bfd_arch_tahoe
17+
| Bfd_arch_i860
18+
| Bfd_arch_i370
19+
| Bfd_arch_romp
20+
| Bfd_arch_convex
21+
| Bfd_arch_m88k
22+
| Bfd_arch_m98k
23+
| Bfd_arch_pyramid
24+
| Bfd_arch_h8300
25+
| Bfd_arch_pdp11
26+
| Bfd_arch_plugin
27+
| Bfd_arch_powerpc
28+
| Bfd_arch_rs6000
29+
| Bfd_arch_hppa
30+
| Bfd_arch_d10v
31+
| Bfd_arch_d30v
32+
| Bfd_arch_dlx
33+
| Bfd_arch_m68hc11
34+
| Bfd_arch_m68hc12
35+
| Bfd_arch_z8k
36+
| Bfd_arch_h8500
37+
| Bfd_arch_sh
38+
| Bfd_arch_alpha
39+
| Bfd_arch_arm
40+
| Bfd_arch_ns32k
41+
| Bfd_arch_w65
42+
| Bfd_arch_tic30
43+
| Bfd_arch_tic4x
44+
| Bfd_arch_tic54x
45+
| Bfd_arch_tic6x
46+
| Bfd_arch_tic80
47+
| Bfd_arch_v850
48+
| Bfd_arch_arc
49+
| Bfd_arch_m32c
50+
| Bfd_arch_m32r
51+
| Bfd_arch_mn10200
52+
| Bfd_arch_mn10300
53+
| Bfd_arch_fr30
54+
| Bfd_arch_frv
55+
| Bfd_arch_moxie
56+
| Bfd_arch_mcore
57+
| Bfd_arch_mep
58+
| Bfd_arch_ia64
59+
| Bfd_arch_ip2k
60+
| Bfd_arch_iq2000
61+
| Bfd_arch_mt
62+
| Bfd_arch_pj
63+
| Bfd_arch_avr
64+
| Bfd_arch_bfin
65+
| Bfd_arch_cr16
66+
| Bfd_arch_cr16c
67+
| Bfd_arch_crx
68+
| Bfd_arch_cris
69+
| Bfd_arch_rx
70+
| Bfd_arch_s390
71+
| Bfd_arch_score
72+
| Bfd_arch_openrisc
73+
| Bfd_arch_mmix
74+
| Bfd_arch_xstormy16
75+
| Bfd_arch_msp430
76+
| Bfd_arch_xc16x
77+
| Bfd_arch_xtensa
78+
| Bfd_arch_z80
79+
| Bfd_arch_lm32
80+
| Bfd_arch_microblaze
81+
| Bfd_arch_last
82+
and machine_t = int
83+
84+
let mach_i386_i386 = 1
85+
86+
let mach_x86_64 = 64
87+
88+
let mach_arm_5TE = 9
89+

arch_bfd.mli

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
(* File generated from arch.idl *)
2+
3+
type bfd_architecture =
4+
| Bfd_arch_unknown
5+
| Bfd_arch_obscure
6+
| Bfd_arch_m68k
7+
| Bfd_arch_vax
8+
| Bfd_arch_i960
9+
| Bfd_arch_or32
10+
| Bfd_arch_sparc
11+
| Bfd_arch_spu
12+
| Bfd_arch_mips
13+
| Bfd_arch_i386
14+
| Bfd_arch_l1om
15+
| Bfd_arch_we32k
16+
| Bfd_arch_tahoe
17+
| Bfd_arch_i860
18+
| Bfd_arch_i370
19+
| Bfd_arch_romp
20+
| Bfd_arch_convex
21+
| Bfd_arch_m88k
22+
| Bfd_arch_m98k
23+
| Bfd_arch_pyramid
24+
| Bfd_arch_h8300
25+
| Bfd_arch_pdp11
26+
| Bfd_arch_plugin
27+
| Bfd_arch_powerpc
28+
| Bfd_arch_rs6000
29+
| Bfd_arch_hppa
30+
| Bfd_arch_d10v
31+
| Bfd_arch_d30v
32+
| Bfd_arch_dlx
33+
| Bfd_arch_m68hc11
34+
| Bfd_arch_m68hc12
35+
| Bfd_arch_z8k
36+
| Bfd_arch_h8500
37+
| Bfd_arch_sh
38+
| Bfd_arch_alpha
39+
| Bfd_arch_arm
40+
| Bfd_arch_ns32k
41+
| Bfd_arch_w65
42+
| Bfd_arch_tic30
43+
| Bfd_arch_tic4x
44+
| Bfd_arch_tic54x
45+
| Bfd_arch_tic6x
46+
| Bfd_arch_tic80
47+
| Bfd_arch_v850
48+
| Bfd_arch_arc
49+
| Bfd_arch_m32c
50+
| Bfd_arch_m32r
51+
| Bfd_arch_mn10200
52+
| Bfd_arch_mn10300
53+
| Bfd_arch_fr30
54+
| Bfd_arch_frv
55+
| Bfd_arch_moxie
56+
| Bfd_arch_mcore
57+
| Bfd_arch_mep
58+
| Bfd_arch_ia64
59+
| Bfd_arch_ip2k
60+
| Bfd_arch_iq2000
61+
| Bfd_arch_mt
62+
| Bfd_arch_pj
63+
| Bfd_arch_avr
64+
| Bfd_arch_bfin
65+
| Bfd_arch_cr16
66+
| Bfd_arch_cr16c
67+
| Bfd_arch_crx
68+
| Bfd_arch_cris
69+
| Bfd_arch_rx
70+
| Bfd_arch_s390
71+
| Bfd_arch_score
72+
| Bfd_arch_openrisc
73+
| Bfd_arch_mmix
74+
| Bfd_arch_xstormy16
75+
| Bfd_arch_msp430
76+
| Bfd_arch_xc16x
77+
| Bfd_arch_xtensa
78+
| Bfd_arch_z80
79+
| Bfd_arch_lm32
80+
| Bfd_arch_microblaze
81+
| Bfd_arch_last
82+
and machine_t = int
83+
84+
val mach_i386_i386 : int
85+
val mach_x86_64 : int
86+
val mach_arm_5TE : int

bap-traces.mldylib

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: b56d9d6a01cc05c3b4973c44d457a209)
3+
Trace_container
4+
Frame_piqi
5+
Frame_piqi_ext
6+
Arch_bfd
7+
# OASIS_STOP

bap-traces.mllib

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# OASIS_START
2+
# DO NOT EDIT (digest: b56d9d6a01cc05c3b4973c44d457a209)
3+
Trace_container
4+
Frame_piqi
5+
Frame_piqi_ext
6+
Arch_bfd
7+
# OASIS_STOP

configure

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
# OASIS_START
4+
# DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499)
5+
set -e
6+
7+
FST=true
8+
for i in "$@"; do
9+
if $FST; then
10+
set --
11+
FST=false
12+
fi
13+
14+
case $i in
15+
--*=*)
16+
ARG=${i%%=*}
17+
VAL=${i##*=}
18+
set -- "$@" "$ARG" "$VAL"
19+
;;
20+
*)
21+
set -- "$@" "$i"
22+
;;
23+
esac
24+
done
25+
26+
ocaml setup.ml -configure "$@"
27+
# OASIS_STOP

exceptionframe.piqi

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.include [
2+
.module types
3+
]
4+
5+
% Represent an exception
6+
.record [
7+
.name exception-frame
8+
9+
% Number representing the exception type
10+
.field [
11+
.type exception-number
12+
.code 1
13+
]
14+
15+
% Thread the exception occured in
16+
.field [
17+
.type thread-id
18+
.optional
19+
.code 2
20+
]
21+
22+
% Address the exception occured at
23+
.field [
24+
.name from-addr
25+
.type address
26+
.optional
27+
.code 3
28+
]
29+
30+
% Address the exception transferred control to
31+
.field [
32+
.name to-addr
33+
.type address
34+
.optional
35+
.code 4
36+
]
37+
]

0 commit comments

Comments
 (0)