Clear syscall and sysregs sdbs if their files are not found (#379)

* Clear syscall and sysregs sdbs if their files are not found
* "Fix" cmd_k tests

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
This commit is contained in:
Khairul Azhar Kasmiran 2021-01-18 17:09:47 +08:00 committed by GitHub
parent 3212a6cf10
commit ea73a9c2fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 65 deletions

View file

@ -52,6 +52,9 @@ static Sdb *openDatabase(Sdb *db, const char *name) {
} else {
db = sdb_new (0, file, 0);
}
} else {
sdb_free (db);
db = sdb_new0 ();
}
free (file);
return db;

View file

@ -610,7 +610,6 @@ RUN
NAME=avr stop analysis when invalid instruction is found
FILE=bins/firmware/arduino_avr.bin
ARGS=-e asm.os=linux
CMDS=<<EOF
e asm.arch=avr
aaa
@ -673,36 +672,36 @@ EXPECT=<<EOF
0x00000158 13478 entry0
0x00000158 2 pcl
0x000001ba 188 fcn.000001ba
0x000001d0 1 syscall.read.2
0x00000260 1 syscall.read.3
0x000001d0 1 syscall.0.2
0x00000260 1 syscall.0.3
0x0000029e 164 fcn.0000029e
0x000002ae 1 syscall.read.5
0x000002f2 1 syscall.inotify_rm_watch.1
0x00000318 1 syscall.inotify_rm_watch.0
0x00000330 1 syscall.inotify_rm_watch
0x000002ae 1 syscall.0.5
0x000002f2 1 syscall.255.1
0x00000318 1 syscall.255.0
0x00000330 1 syscall.255
0x00000342 5256 fcn.00000342
0x00000360 152 fcn.00000360
0x0000036c 1 syscall.read.26
0x0000036c 1 syscall.0.26
0x00000390 4 aav.0x00000390
0x000003ea 1 syscall.read.27
0x000003ea 1 syscall.0.27
0x0000048c 24 fcn.0000048c
0x0000048e 1 syscall.read.19
0x0000048e 1 syscall.0.19
0x000004a4 72 fcn.000004a4
0x000004a6 1 syscall.read.6
0x000004a6 1 syscall.0.6
0x000004ec 76 fcn.000004ec
0x00000504 4 aav.0x00000504
0x0000054e 84 fcn.0000054e
0x0000054e 1 syscall.read.25
0x0000054e 1 syscall.0.25
0x000005a2 78 fcn.000005a2
0x000005f0 114 fcn.000005f0
0x0000062a 1 syscall.uname
0x0000062e 1 syscall.rt_sigprocmask
0x0000063e 1 syscall.uname.1
0x00000644 1 syscall.rt_sigprocmask.0
0x00000652 1 syscall.uname.0
0x0000062a 1 syscall.63
0x0000062e 1 syscall.14
0x0000063e 1 syscall.63.1
0x00000644 1 syscall.14.0
0x00000652 1 syscall.63.0
0x00000662 108 fcn.00000662
0x000006ae 1 syscall.read.4
0x000006b6 1 syscall.sched_rr_get_interval
0x000006ae 1 syscall.0.4
0x000006b6 1 syscall.148
0x00000770 44 fcn.00000770
0x0000079c 74 fcn.0000079c
0x000007e6 106 fcn.000007e6
@ -711,43 +710,43 @@ EXPECT=<<EOF
0x00000876 40 fcn.00000876
0x000008e6 36 fcn.000008e6
0x00000952 178 fcn.00000952
0x00000972 1 syscall.read.7
0x000009e2 1 syscall.read.8
0x00000972 1 syscall.0.7
0x000009e2 1 syscall.0.8
0x00000a04 148 fcn.00000a04
0x00000afc 26 fcn.00000afc
0x00000bae 240 fcn.00000bae
0x00000bf0 1 syscall.read.17
0x00000bf2 1 syscall.read.18
0x00000c90 1 syscall.read.40
0x00000c92 1 syscall.read.41
0x00000c94 1 syscall.read.42
0x00000c96 1 syscall.read.43
0x00000d2e 1 syscall.read.39
0x00000bf0 1 syscall.0.17
0x00000bf2 1 syscall.0.18
0x00000c90 1 syscall.0.40
0x00000c92 1 syscall.0.41
0x00000c94 1 syscall.0.42
0x00000c96 1 syscall.0.43
0x00000d2e 1 syscall.0.39
0x00000d78 4 aav.0x00000d78
0x00000dac 92 fcn.00000dac
0x00000e08 92 fcn.00000e08
0x00000e64 56 fcn.00000e64
0x00000e9c 12 fcn.00000e9c
0x00000ea8 198 fcn.00000ea8
0x00000ef4 1 syscall.read.22
0x00000f0c 1 syscall.read.21
0x00000f2e 1 syscall.read.20
0x00000ef4 1 syscall.0.22
0x00000f0c 1 syscall.0.21
0x00000f2e 1 syscall.0.20
0x00000fd0 206 fcn.00000fd0
0x00000ff0 1 syscall.read.24
0x00001018 1 syscall.read.23
0x0000110c 1 syscall.io_getevents
0x00000ff0 1 syscall.0.24
0x00001018 1 syscall.0.23
0x0000110c 1 syscall.208
0x0000113a 136 fcn.0000113a
0x00001174 1 syscall.read.44
0x00001176 1 syscall.read.45
0x00001178 1 syscall.read.46
0x0000117a 1 syscall.read.47
0x00001174 1 syscall.0.44
0x00001176 1 syscall.0.45
0x00001178 1 syscall.0.46
0x0000117a 1 syscall.0.47
0x00001202 12 fcn.00001202
0x0000120e 106 fcn.0000120e
0x00001238 1 syscall.read.1
0x00001238 1 syscall.0.1
0x00001294 24 fcn.00001294
0x00001296 10 fcn.00001296
0x000012c2 58 fcn.000012c2
0x000012d0 1 syscall.read.48
0x000012d0 1 syscall.0.48
0x000012fc 26 fcn.000012fc
0x00001316 26 fcn.00001316
0x00001394 14 fcn.00001394
@ -759,7 +758,7 @@ EXPECT=<<EOF
0x00001490 2 int.00001490
0x0000149e 16 fcn.0000149e
0x0000152c 34 fcn.0000152c
0x000017b6 1 syscall.write
0x000017b6 1 syscall.1
0x00001b0c 36 fcn.00001b0c
0x00001b30 52 fcn.00001b30
0x00001b64 56 fcn.00001b64
@ -772,17 +771,17 @@ EXPECT=<<EOF
0x00001f24 14 fcn.00001f24
0x00001f32 76 fcn.00001f32
0x00001f7e 100 fcn.00001f7e
0x00001f92 1 syscall.read.33
0x00001fcc 1 syscall.read.34
0x00001f92 1 syscall.0.33
0x00001fcc 1 syscall.0.34
0x00001fe2 14 fcn.00001fe2
0x00001ff0 80 fcn.00001ff0
0x0000202a 1 syscall.read.32
0x0000202a 1 syscall.0.32
0x00002040 102 fcn.00002040
0x00002054 1 syscall.read.35
0x00002090 1 syscall.read.36
0x00002054 1 syscall.0.35
0x00002090 1 syscall.0.36
0x000020a6 102 fcn.000020a6
0x000020ba 1 syscall.read.37
0x000020f6 1 syscall.read.38
0x000020ba 1 syscall.0.37
0x000020f6 1 syscall.0.38
0x0000220e 96 fcn.0000220e
0x0000246e 34 fcn.0000246e
0x000025dc 156 fcn.000025dc
@ -791,7 +790,7 @@ EXPECT=<<EOF
0x00002a54 328 fcn.00002a54
0x00002c26 304 fcn.00002c26
0x00002d56 286 fcn.00002d56
0x00002ec2 1 syscall.read
0x00002ec2 1 syscall.0
0x00002ec8 16 fcn.00002ec8
0x00002ed8 16 fcn.00002ed8
0x00002ee8 16 fcn.00002ee8
@ -805,33 +804,33 @@ EXPECT=<<EOF
0x00002f9e 22 fcn.00002f9e
0x00002fb4 52 fcn.00002fb4
0x00002fe8 44 fcn.00002fe8
0x0000300a 1 syscall.read.28
0x0000300a 1 syscall.0.28
0x00003014 184 fcn.00003014
0x00003036 1 syscall.read.30
0x00003038 1 syscall.read.31
0x0000303a 1 syscall.inotify_rm_watch.4
0x00003036 1 syscall.0.30
0x00003038 1 syscall.0.31
0x0000303a 1 syscall.255.4
0x00003048 42 fcn.00003048
0x00003072 24 fcn.00003072
0x00003098 1 syscall.read.29
0x00003098 1 syscall.0.29
0x000030cc 1182 fcn.000030cc
0x00003116 2 fcn.00003116
0x00003118 8 fcn.00003118
0x000031e0 8 fcn.000031e0
0x000031e8 4 fcn.000031e8
0x000032b8 10 fcn.000032b8
0x000032ba 1 syscall.read.12
0x000032ba 1 syscall.0.12
0x000032c2 88 fcn.000032c2
0x0000330a 1 syscall.read.9
0x0000330c 1 syscall.read.10
0x0000330e 1 syscall.inotify_rm_watch.2
0x0000330a 1 syscall.0.9
0x0000330c 1 syscall.0.10
0x0000330e 1 syscall.255.2
0x0000331a 4 fcn.0000331a
0x0000331a 1 syscall.read.11
0x0000331a 1 syscall.0.11
0x0000331e 118 fcn.0000331e
0x0000331e 1 syscall.read.13
0x00003322 1 syscall.read.15
0x00003324 1 syscall.read.16
0x00003326 1 syscall.inotify_rm_watch.3
0x00003390 1 syscall.read.14
0x0000331e 1 syscall.0.13
0x00003322 1 syscall.0.15
0x00003324 1 syscall.0.16
0x00003326 1 syscall.255.3
0x00003390 1 syscall.0.14
0x0000347e 8 fcn.0000347e
0x00003486 4 fcn.00003486
0x0000354c 8 fcn.0000354c
@ -839,7 +838,7 @@ EXPECT=<<EOF
0x000035be 22 fcn.000035be
0x000035d4 8 fcn.000035d4
0x000035dc 30 fcn.000035dc
0x000035fa 1 syscall.read.0
0x000035fa 1 syscall.0.0
0x00008000 2 r29_rz8
0x00008000 2 y
0x00008000 2 sp

View file

@ -1,5 +1,6 @@
NAME=1: k syscall/
FILE=malloc://512
ARGS=-a x86 -k linux
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
@ -13,6 +14,7 @@ RUN
NAME=2: k syscall/
FILE=malloc://512
ARGS=-a x86 -k linux
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64