-
Notifications
You must be signed in to change notification settings - Fork 3
/
gdbinit
3998 lines (3712 loc) · 109 KB
/
gdbinit
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file, for x86/x86_64 and ARM platforms.
#
# REVISION : 8.0.5 (18/08/2013)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: http://reverse.put.as - reverser@put.as
#
# NOTES: 'help user' in gdb will list the commands/descriptions in this file
# 'context on' now enables auto-display of context screen
#
# MAC OS X NOTES: If you are using this on Mac OS X, you must either attach gdb to a process
# or launch gdb without any options and then load the binary file you want to analyse with "exec-file" option
# If you load the binary from the command line, like $gdb binary-name, this will not work as it should
# For more information, read it here http://reverse.put.as/2008/11/28/apples-gdb-bug/
#
# UPDATE: This bug can be fixed in gdb source. Refer to http://reverse.put.as/2009/08/10/fix-for-apples-gdb-bug-or-why-apple-forks-are-bad/
# and http://reverse.put.as/2009/08/26/gdb-patches/ (if you want the fixed binary for i386)
#
# An updated version of the patch and binary is available at http://reverse.put.as/2011/02/21/update-to-gdb-patches-fix-a-new-bug/
#
# iOS NOTES: iOS gdb from Cydia (and Apple's) suffer from the same OS X bug.
# If you are using this on Mac OS X or iOS, you must either attach gdb to a process
# or launch gdb without any options and then load the binary file you want to analyse with "exec-file" option
# If you load the binary from the command line, like $gdb binary-name, this will not work as it should
# For more information, read it here http://reverse.put.as/2008/11/28/apples-gdb-bug/
#
# CHANGELOG: (older changes at the end of the file)
#
# Version 8.0.6 (05/09/2013)
# - Add patch command to convert bytes to little-endian and patch memory
#
# Version 8.0.5 (18/08/2013)
# - Add commands header and loadcmds to dump Mach-O header information
# - Other fixes and additions from previous commits
#
# Version 8.0.4 (08/05/2013)
# - Detect automatically 32 or 64 bits archs using sizeof(void*).
# Thanks to Tyilo for the simple but very effective idea!
# - Typo in hexdump command also fixed by vuquangtrong.
# - Add shortcuts to attach to VMware kernel debugging gdb stub (kernel32 and kernel64)
#
# Version 8.0.3 (21/03/2013)
# - Add option to colorize or not output (thanks to argp and skier for the request and ideas!)
# - Convert the escape codes into functions so colors can be easily customized
# - Other enhancements available at git commit logs
# Thanks to Plouj, argp, xristos for their ideas and fixes!
#
# Version 8.0.2 (31/07/2012)
# - Merge pull request from mheistermann to support local modifications in a .gdbinit.local file
# - Add a missing opcode to the stepo command
#
# Version 8.0.1 (23/04/2012)
# - Small bug fix to the attsyntax and intelsyntax commands (changing X86 flavor variable was missing)
#
# Version 8.0 (13/04/2012)
# - Merged x86/x64 and ARM versions
# - Added commands intelsyntax and attsyntax to switch between x86 disassembly flavors
# - Added new configuration variables ARM, ARMOPCODES, and X86FLAVOR
# - Code cleanups and fixes to the indentation
# - Bug fixes to some ARM related code
# - Added the dumpmacho command to memory dump the mach-o header to a file
#
# TODO:
#
# __________________gdb options_________________
# set to 1 to have ARM target debugging as default, use the "arm" command to switch inside gdb
set $ARM = 0
# set to 0 if you have problems with the colorized prompt - reported by Plouj with Ubuntu gdb 7.2
set $COLOREDPROMPT = 1
# color the first line of the disassembly - default is green, if you want to change it search for
# SETCOLOR1STLINE and modify it :-)
set $SETCOLOR1STLINE = 0
# set to 0 to remove display of objectivec messages (default is 1)
set $SHOWOBJECTIVEC = 1
# set to 0 to remove display of cpu registers (default is 1)
set $SHOWCPUREGISTERS = 1
# set to 1 to enable display of stack (default is 0)
set $SHOWSTACK = 0
# set to 1 to enable display of data window (default is 0)
set $SHOWDATAWIN = 0
# set to 0 to disable colored display of changed registers
set $SHOWREGCHANGES = 1
# set to 1 so skip command to execute the instruction at the new location
# by default it EIP/RIP will be modified and update the new context but not execute the instruction
set $SKIPEXECUTE = 0
# if $SKIPEXECUTE is 1 configure the type of execution
# 1 = use stepo (do not get into calls), 0 = use stepi (step into calls)
set $SKIPSTEP = 1
# show the ARM opcodes - change to 0 if you don't want such thing (in x/i command)
set $ARMOPCODES = 1
# x86 disassembly flavor: 0 for Intel, 1 for AT&T
set $X86FLAVOR = 0
# use colorized output or not
set $USECOLOR = 1
# to use with remote KDP
set $KDP64BITS = -1
set $64BITS = 0
set confirm off
set verbose off
set history filename ~/.gdb_history
set history save
set output-radix 0x10
set input-radix 0x10
# These make gdb never pause in its output
set height 0
set width 0
set $SHOW_CONTEXT = 1
set $SHOW_NEST_INSN = 0
set $CONTEXTSIZE_STACK = 6
set $CONTEXTSIZE_DATA = 8
set $CONTEXTSIZE_CODE = 8
# __________________end gdb options_________________
#
# __________________color functions_________________
#
# color codes
set $BLACK = 0
set $RED = 1
set $GREEN = 2
set $YELLOW = 3
set $BLUE = 4
set $MAGENTA = 5
set $CYAN = 6
set $WHITE = 7
# CHANGME: If you want to modify the "theme" change the colors here
# or just create a ~/.gdbinit.local and set these variables there
set $COLOR_REGNAME = $GREEN
set $COLOR_REGVAL = $BLACK
set $COLOR_REGVAL_MODIFIED = $RED
set $COLOR_SEPARATOR = $BLUE
set $COLOR_CPUFLAGS = $RED
# this is ugly but there's no else if available :-(
define color
if $USECOLOR == 1
# BLACK
if $arg0 == 0
echo \033[30m
else
# RED
if $arg0 == 1
echo \033[31m
else
# GREEN
if $arg0 == 2
echo \033[32m
else
# YELLOW
if $arg0 == 3
echo \033[33m
else
# BLUE
if $arg0 == 4
echo \033[34m
else
# MAGENTA
if $arg0 == 5
echo \033[35m
else
# CYAN
if $arg0 == 6
echo \033[36m
else
# WHITE
if $arg0 == 7
echo \033[37m
end
end
end
end
end
end
end
end
end
end
define color_reset
if $USECOLOR == 1
echo \033[0m
end
end
define color_bold
if $USECOLOR == 1
echo \033[1m
end
end
define color_underline
if $USECOLOR == 1
echo \033[4m
end
end
# this way anyone can have their custom prompt - argp's idea :-)
# can also be used to redefine anything else in particular the colors aka theming
# just remap the color variables defined above
source ~/.gdbinit.local
# can't use the color functions because we are using the set command
if $COLOREDPROMPT == 1
set prompt \033[31mgdb$ \033[0m
end
# Initialize these variables else comparisons will fail for coloring
# we must initialize all of them at once, 32 and 64 bits, and ARM.
set $oldrax = 0
set $oldrbx = 0
set $oldrcx = 0
set $oldrdx = 0
set $oldrsi = 0
set $oldrdi = 0
set $oldrbp = 0
set $oldrsp = 0
set $oldr8 = 0
set $oldr9 = 0
set $oldr10 = 0
set $oldr11 = 0
set $oldr12 = 0
set $oldr13 = 0
set $oldr14 = 0
set $oldr15 = 0
set $oldeax = 0
set $oldebx = 0
set $oldecx = 0
set $oldedx = 0
set $oldesi = 0
set $oldedi = 0
set $oldebp = 0
set $oldesp = 0
set $oldr0 = 0
set $oldr1 = 0
set $oldr2 = 0
set $oldr3 = 0
set $oldr4 = 0
set $oldr5 = 0
set $oldr6 = 0
set $oldr7 = 0
set $oldsp = 0
set $oldlr = 0
# used by ptraceme/rptraceme
set $ptrace_bpnum = 0
# ______________window size control___________
define contextsize-stack
if $argc != 1
help contextsize-stack
else
set $CONTEXTSIZE_STACK = $arg0
end
end
document contextsize-stack
Syntax: contextsize-stack NUM
| Set stack dump window size to NUM lines.
end
define contextsize-data
if $argc != 1
help contextsize-data
else
set $CONTEXTSIZE_DATA = $arg0
end
end
document contextsize-data
Syntax: contextsize-data NUM
| Set data dump window size to NUM lines.
end
define contextsize-code
if $argc != 1
help contextsize-code
else
set $CONTEXTSIZE_CODE = $arg0
end
end
document contextsize-code
Syntax: contextsize-code NUM
| Set code window size to NUM lines.
end
# _____________breakpoint aliases_____________
define bpl
info breakpoints
end
document bpl
Syntax: bpl
| List all breakpoints.
end
define bp
if $argc != 1
help bp
else
break $arg0
end
end
document bp
Syntax: bp LOCATION
| Set breakpoint.
| LOCATION may be a line number, function name, or "*" and an address.
| To break on a symbol you must enclose symbol name inside "".
| Example:
| bp "[NSControl stringValue]"
| Or else you can use directly the break command (break [NSControl stringValue])
end
define bpc
if $argc != 1
help bpc
else
clear $arg0
end
end
document bpc
Syntax: bpc LOCATION
| Clear breakpoint.
| LOCATION may be a line number, function name, or "*" and an address.
end
define bpe
if $argc != 1
help bpe
else
enable $arg0
end
end
document bpe
Syntax: bpe NUM
| Enable breakpoint with number NUM.
end
define bpd
if $argc != 1
help bpd
else
disable $arg0
end
end
document bpd
Syntax: bpd NUM
| Disable breakpoint with number NUM.
end
define bpt
if $argc != 1
help bpt
else
tbreak $arg0
end
end
document bpt
Syntax: bpt LOCATION
| Set a temporary breakpoint.
| This breakpoint will be automatically deleted when hit!.
| LOCATION may be a line number, function name, or "*" and an address.
end
define bpm
if $argc != 1
help bpm
else
awatch $arg0
end
end
document bpm
Syntax: bpm EXPRESSION
| Set a read/write breakpoint on EXPRESSION, e.g. *address.
end
define bhb
if $argc != 1
help bhb
else
hb $arg0
end
end
document bhb
Syntax: bhb LOCATION
| Set hardware assisted breakpoint.
| LOCATION may be a line number, function name, or "*" and an address.
end
define bht
if $argc != 1
help bht
else
thbreak $arg0
end
end
document bht
Usage: bht LOCATION
| Set a temporary hardware breakpoint.
| This breakpoint will be automatically deleted when hit!
| LOCATION may be a line number, function name, or "*" and an address.
end
# ______________process information____________
define argv
show args
end
document argv
Syntax: argv
| Print program arguments.
end
define stack
if $argc == 0
info stack
end
if $argc == 1
info stack $arg0
end
if $argc > 1
help stack
end
end
document stack
Syntax: stack <COUNT>
| Print backtrace of the call stack, or innermost COUNT frames.
end
define frame
info frame
info args
info locals
end
document frame
Syntax: frame
| Print stack frame.
end
define flagsarm
# conditional flags are
# negative/less than (N), bit 31 of CPSR
# zero (Z), bit 30
# Carry/Borrow/Extend (C), bit 29
# Overflow (V), bit 28
# negative/less than (N), bit 31 of CPSR
if (($cpsr >> 0x1f) & 1)
printf "N "
set $_n_flag = 1
else
printf "n "
set $_n_flag = 0
end
# zero (Z), bit 30
if (($cpsr >> 0x1e) & 1)
printf "Z "
set $_z_flag = 1
else
printf "z "
set $_z_flag = 0
end
# Carry/Borrow/Extend (C), bit 29
if (($cpsr >> 0x1d) & 1)
printf "C "
set $_c_flag = 1
else
printf "c "
set $_c_flag = 0
end
# Overflow (V), bit 28
if (($cpsr >> 0x1c) & 1)
printf "V "
set $_v_flag = 1
else
printf "v "
set $_v_flag = 0
end
# Sticky overflow (Q), bit 27
if (($cpsr >> 0x1b) & 1)
printf "Q "
set $_q_flag = 1
else
printf "q "
set $_q_flag = 0
end
# Java state bit (J), bit 24
# When T=1:
# J = 0 The processor is in Thumb state.
# J = 1 The processor is in ThumbEE state.
if (($cpsr >> 0x18) & 1)
printf "J "
set $_j_flag = 1
else
printf "j "
set $_j_flag = 0
end
# Data endianness bit (E), bit 9
if (($cpsr >> 9) & 1)
printf "E "
set $_e_flag = 1
else
printf "e "
set $_e_flag = 0
end
# Imprecise abort disable bit (A), bit 8
# The A bit is set to 1 automatically. It is used to disable imprecise data aborts.
# It might not be writable in the Nonsecure state if the AW bit in the SCR register is reset.
if (($cpsr >> 8) & 1)
printf "A "
set $_a_flag = 1
else
printf "a "
set $_a_flag = 0
end
# IRQ disable bit (I), bit 7
# When the I bit is set to 1, IRQ interrupts are disabled.
if (($cpsr >> 7) & 1)
printf "I "
set $_i_flag = 1
else
printf "i "
set $_i_flag = 0
end
# FIQ disable bit (F), bit 6
# When the F bit is set to 1, FIQ interrupts are disabled.
# FIQ can be nonmaskable in the Nonsecure state if the FW bit in SCR register is reset.
if (($cpsr >> 6) & 1)
printf "F "
set $_f_flag = 1
else
printf "f "
set $_f_flag = 0
end
# Thumb state bit (F), bit 5
# if 1 then the processor is executing in Thumb state or ThumbEE state depending on the J bit
if (($cpsr >> 5) & 1)
printf "T "
set $_t_flag = 1
else
printf "t "
set $_t_flag = 0
end
# TODO: GE bit ?
end
document flagsarm
Syntax: flagsarm
| Auxiliary function to set ARM cpu flags.
end
define flagsx86
# OF (overflow) flag
if (((unsigned int)$eflags >> 0xB) & 1)
printf "O "
set $_of_flag = 1
else
printf "o "
set $_of_flag = 0
end
# DF (direction) flag
if (((unsigned int)$eflags >> 0xA) & 1)
printf "D "
else
printf "d "
end
# IF (interrupt enable) flag
if (((unsigned int)$eflags >> 9) & 1)
printf "I "
else
printf "i "
end
# TF (trap) flag
if (((unsigned int)$eflags >> 8) & 1)
printf "T "
else
printf "t "
end
# SF (sign) flag
if (((unsigned int)$eflags >> 7) & 1)
printf "S "
set $_sf_flag = 1
else
printf "s "
set $_sf_flag = 0
end
# ZF (zero) flag
if (((unsigned int)$eflags >> 6) & 1)
printf "Z "
set $_zf_flag = 1
else
printf "z "
set $_zf_flag = 0
end
# AF (adjust) flag
if (((unsigned int)$eflags >> 4) & 1)
printf "A "
else
printf "a "
end
# PF (parity) flag
if (((unsigned int)$eflags >> 2) & 1)
printf "P "
set $_pf_flag = 1
else
printf "p "
set $_pf_flag = 0
end
# CF (carry) flag
if ((unsigned int)$eflags & 1)
printf "C "
set $_cf_flag = 1
else
printf "c "
set $_cf_flag = 0
end
printf "\n"
end
document flagsx86
Syntax: flagsx86
| Auxiliary function to set X86/X64 cpu flags.
end
define flags
# call the auxiliary functions based on target cpu
if $ARM == 1
flagsarm
else
flagsx86
end
end
document flags
Syntax: flags
| Print flags register.
end
define eflags
if $ARM == 1
# http://www.heyrick.co.uk/armwiki/The_Status_register
printf " N <%d> Z <%d> C <%d> V <%d>",\
(($cpsr >> 0x1f) & 1), (($cpsr >> 0x1e) & 1), \
(($cpsr >> 0x1d) & 1), (($cpsr >> 0x1c) & 1)
printf " Q <%d> J <%d> GE <%d> E <%d> A <%d>",\
(($cpsr >> 0x1b) & 1), (($cpsr >> 0x18) & 1),\
(($cpsr >> 0x10) & 7), (($cpsr >> 9) & 1), (($cpsr >> 8) & 1)
printf " I <%d> F <%d> T <%d> \n",\
(($cpsr >> 7) & 1), (($cpsr >> 6) & 1), \
(($cpsr >> 5) & 1)
else
printf " OF <%d> DF <%d> IF <%d> TF <%d>",\
(((unsigned int)$eflags >> 0xB) & 1), (((unsigned int)$eflags >> 0xA) & 1), \
(((unsigned int)$eflags >> 9) & 1), (((unsigned int)$eflags >> 8) & 1)
printf " SF <%d> ZF <%d> AF <%d> PF <%d> CF <%d>\n",\
(((unsigned int)$eflags >> 7) & 1), (((unsigned int)$eflags >> 6) & 1),\
(((unsigned int)$eflags >> 4) & 1), (((unsigned int)$eflags >> 2) & 1), ((unsigned int)$eflags & 1)
printf " ID <%d> VIP <%d> VIF <%d> AC <%d>",\
(((unsigned int)$eflags >> 0x15) & 1), (((unsigned int)$eflags >> 0x14) & 1), \
(((unsigned int)$eflags >> 0x13) & 1), (((unsigned int)$eflags >> 0x12) & 1)
printf " VM <%d> RF <%d> NT <%d> IOPL <%d>\n",\
(((unsigned int)$eflags >> 0x11) & 1), (((unsigned int)$eflags >> 0x10) & 1),\
(((unsigned int)$eflags >> 0xE) & 1), (((unsigned int)$eflags >> 0xC) & 3)
end
end
document eflags
Syntax: eflags
| Print eflags register.
end
define cpsr
eflags
end
document cpsr
Syntax: cpsr
| Print cpsr register.
end
define regarm
printf " "
# R0
color $COLOR_REGNAME
printf "R0:"
if ($r0 != $oldr0 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r0
# R1
color $COLOR_REGNAME
printf "R1:"
if ($r1 != $oldr1 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r1
# R2
color $COLOR_REGNAME
printf "R2:"
if ($r2 != $oldr2 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r2
# R3
color $COLOR_REGNAME
printf "R3:"
if ($r3 != $oldr3 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X\n", $r3
printf " "
# R4
color $COLOR_REGNAME
printf "R4:"
if ($r4 != $oldr4 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r4
# R5
color $COLOR_REGNAME
printf "R5:"
if ($r5 != $oldr5 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r5
# R6
color $COLOR_REGNAME
printf "R6:"
if ($r6 != $oldr6 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r6
# R7
color $COLOR_REGNAME
printf "R7:"
if ($r7 != $oldr7 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X\n", $r7
printf " "
# R8
color $COLOR_REGNAME
printf "R8:"
if ($r8 != $oldr8 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r8
# R9
color $COLOR_REGNAME
printf "R9:"
if ($r9 != $oldr9 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r9
# R10
color $COLOR_REGNAME
printf "R10:"
if ($r10 != $oldr10 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r10
# R11
color $COLOR_REGNAME
printf "R11:"
if ($r11 != $oldr11 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $r11
dumpjump
printf "\n"
# R12
color $COLOR_REGNAME
printf " R12:"
if ($r12 != $oldr12 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X", $r12
printf " "
# SP
color $COLOR_REGNAME
printf "SP:"
if ($sp != $oldsp && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $sp
# LR
color $COLOR_REGNAME
printf "LR:"
if ($lr != $oldlr && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%08X ", $lr
# PC
color $COLOR_REGNAME
printf "PC:"
color $COLOR_REGVAL_MODIFIED
printf " 0x%08X ", $pc
color_bold
color_underline
color $COLOR_CPUFLAGS
flags
color_reset
printf "\n"
end
document regarm
Syntax: regarm
| Auxiliary function to display ARM registers.
end
define regx64
# 64bits stuff
printf " "
# RAX
color $COLOR_REGNAME
printf "RAX:"
if ($rax != $oldrax && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rax
# RBX
color $COLOR_REGNAME
printf "RBX:"
if ($rbx != $oldrbx && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rbx
# RBP
color $COLOR_REGNAME
printf "RBP:"
if ($rbp != $oldrbp && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rbp
# RSP
color $COLOR_REGNAME
printf "RSP:"
if ($rsp != $oldrsp && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rsp
color_bold
color_underline
color $COLOR_CPUFLAGS
flags
color_reset
printf " "
# RDI
color $COLOR_REGNAME
printf "RDI:"
if ($rdi != $oldrdi && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rdi
# RSI
color $COLOR_REGNAME
printf "RSI:"
if ($rsi != $oldrsi && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rsi
# RDX
color $COLOR_REGNAME
printf "RDX:"
if ($rdx != $oldrdx && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rdx
# RCX
color $COLOR_REGNAME
printf "RCX:"
if ($rcx != $oldrcx && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $rcx
# RIP
color $COLOR_REGNAME
printf "RIP:"
color $COLOR_REGVAL_MODIFIED
printf " 0x%016lX\n ", $rip
# R8
color $COLOR_REGNAME
printf "R8 :"
if ($r8 != $oldr8 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $r8
# R9
color $COLOR_REGNAME
printf "R9 :"
if ($r9 != $oldr9 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $r9
# R10
color $COLOR_REGNAME
printf "R10:"
if ($r10 != $oldr10 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $r10
# R11
color $COLOR_REGNAME
printf "R11:"
if ($r11 != $oldr11 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $r11
# R12
color $COLOR_REGNAME
printf "R12:"
if ($r12 != $oldr12 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX\n ", $r12
# R13
color $COLOR_REGNAME
printf "R13:"
if ($r13 != $oldr13 && $SHOWREGCHANGES == 1)
color $COLOR_REGVAL_MODIFIED
else
color $COLOR_REGVAL
end
printf " 0x%016lX ", $r13