• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# connect gdb to Valgrind gdbserver:
2target remote | ./vgdb --wait=60 --vgdb-prefix=./vgdb-prefix-mcvabits
3echo vgdb launched process attached\n
4monitor v.set vgdb-error 999999
5#
6#
7# insert break:
8break breakme
9#
10# continue till //1break:
11continue
12#
13# up to main:
14up
15#
16# print local string variables:
17print main_name
18print undefined
19# save address of undefined
20set $0xundefined = &undefined
21#
22# Verif A-bits, V-bits, Get V-bits: A,V,G [0..9]
23eval "monitor check_memory addressable 0x%lx 10", $0xundefined
24eval "monitor check_memory defined     0x%lx 10", $0xundefined
25eval "monitor get_vbits                0x%lx 10", $0xundefined
26eval "monitor xb                       0x%lx 10", $0xundefined
27#
28# continue till //2break:
29continue
30#
31# A,V,G [0..9] after the undefinition of some bytes by executable:
32eval "monitor check_memory addressable 0x%lx 10", $0xundefined
33eval "monitor check_memory defined     0x%lx 10", $0xundefined
34eval "monitor get_vbits                0x%lx 10", $0xundefined
35#
36# Redefine [2..4]
37set $0xundefined_2 = (char*)$0xundefined + 2
38eval "monitor make_memory defined 0x%lx 3", $0xundefined_2
39# A,V,G
40eval "monitor check_memory addressable 0x%lx 10", $0xundefined
41eval "monitor check_memory defined     0x%lx 10", $0xundefined
42eval "monitor get_vbits                0x%lx 10", $0xundefined
43#
44# Undefine [2..5]
45eval "monitor make_memory  undefined   0x%lx 4", $0xundefined_2
46# A,V,G [0..9]
47eval "monitor check_memory addressable 0x%lx 10", $0xundefined
48eval "monitor check_memory defined     0x%lx 10", $0xundefined
49eval "monitor get_vbits                0x%lx 10", $0xundefined
50#
51# noaccess [2..3]
52eval "monitor make_memory  noaccess    0x%lx 2", $0xundefined_2
53# A,V,G [0..1]
54eval "monitor check_memory addressable 0x%lx 2", $0xundefined
55eval "monitor check_memory defined     0x%lx 2", $0xundefined
56eval "monitor get_vbits                0x%lx 2", $0xundefined
57# A,V,G [2..3]
58eval "monitor check_memory addressable 0x%lx 2", $0xundefined_2
59eval "monitor check_memory defined     0x%lx 2", $0xundefined_2
60eval "monitor get_vbits                0x%lx 2", $0xundefined_2
61# A,V,G [4..9]
62set  $0xundefined_4 = (char*) $0xundefined_2 + 2
63eval "monitor check_memory addressable 0x%lx 6", $0xundefined_4
64eval "monitor check_memory defined     0x%lx 6", $0xundefined_4
65eval "monitor get_vbits                0x%lx 6", $0xundefined_4
66#
67# Definedifaddressable undefined[0..9]
68eval "monitor make_memory  Definedifaddressable 0x%lx 10", $0xundefined
69# A,V,G
70eval "monitor check_memory addressable 0x%lx 10", $0xundefined
71eval "monitor check_memory defined     0x%lx 10", $0xundefined
72eval "monitor get_vbits                0x%lx 10", $0xundefined
73#
74monitor v.kill
75quit
76