forked from gdbinit/Gdbinit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdbinit
3512 lines (3236 loc) · 92.5 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.2 (31/07/2012)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: http://reverse.put.as - [email protected]
#
# 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.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 1 to enable 64bits target by default (32bits is the default)
set $64BITS = 0
if $64BITS == 1
printf "64-bit mode is default. Use the 32bits command if your target is 32 bits.\n"
printf "Edit the $64BITS variable in your .gdbinit file to switch to default 32-bit mode.\n"
else
printf "32-bit mode is default. Use the 64bits command if your target is 64 bits.\n"
printf "Edit the $64BITS variable in your .gdbinit file to switch to default 64-bit mode.\n"
end
# set to 0 if you have problems with the colorized prompt - reported by Plouj with Ubuntu gdb 7.2
set $COLOUREDPROMPT = 1
# Colour the first line of the disassembly - default is green, if you want to change it search for
# SETCOLOUR1STLINE and modify it :-)
set $SETCOLOUR1STLINE = 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 coloured 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
set confirm off
set verbose off
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_________________
#
if $COLOUREDPROMPT == 1
set prompt \033[31mgdb$ \033[0m
end
# this way anyone can have their custom prompt - argp's idea :-)
source ~/.gdbinit.local
# Initialize these variables else comparisons will fail for colouring
# 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
Set stack dump window size to NUM lines.
Usage: contextsize-stack NUM
end
define contextsize-data
if $argc != 1
help contextsize-data
else
set $CONTEXTSIZE_DATA = $arg0
end
end
document contextsize-data
Set data dump window size to NUM lines.
Usage: contextsize-data NUM
end
define contextsize-code
if $argc != 1
help contextsize-code
else
set $CONTEXTSIZE_CODE = $arg0
end
end
document contextsize-code
Set code window size to NUM lines.
Usage: contextsize-code NUM
end
# _____________breakpoint aliases_____________
define bpl
info breakpoints
end
document bpl
List all breakpoints.
end
define bp
if $argc != 1
help bp
else
break $arg0
end
end
document bp
Set breakpoint.
Usage: bp LOCATION
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
Clear breakpoint.
Usage: bpc LOCATION
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
Enable breakpoint with number NUM.
Usage: bpe NUM
end
define bpd
if $argc != 1
help bpd
else
disable $arg0
end
end
document bpd
Disable breakpoint with number NUM.
Usage: bpd NUM
end
define bpt
if $argc != 1
help bpt
else
tbreak $arg0
end
end
document bpt
Set a temporary breakpoint.
This breakpoint will be automatically deleted when hit!.
Usage: bpt LOCATION
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
Set a read/write breakpoint on EXPRESSION, e.g. *address.
Usage: bpm EXPRESSION
end
define bhb
if $argc != 1
help bhb
else
hb $arg0
end
end
document bhb
Set hardware assisted breakpoint.
Usage: bhb LOCATION
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
Set a temporary hardware breakpoint.
This breakpoint will be automatically deleted when hit!
Usage: bht LOCATION
LOCATION may be a line number, function name, or "*" and an address.
end
# ______________process information____________
define argv
show args
end
document 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
Print backtrace of the call stack, or innermost COUNT frames.
Usage: stack <COUNT>
end
define frame
info frame
info args
info locals
end
document 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->n & 1)
printf "N "
set $_n_flag = 1
else
printf "n "
set $_n_flag = 0
end
# zero (Z), bit 30
if ($cpsr->z & 1)
printf "Z "
set $_z_flag = 1
else
printf "z "
set $_z_flag = 0
end
# Carry/Borrow/Extend (C), bit 29
if ($cpsr->c & 1)
printf "C "
set $_c_flag = 1
else
printf "c "
set $_c_flag = 0
end
# Overflow (V), bit 28
if ($cpsr->v & 1)
printf "V "
set $_v_flag = 1
else
printf "v "
set $_v_flag = 0
end
# Sticky overflow (Q), bit 27
if ($cpsr->q & 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->j & 1)
printf "J "
set $_j_flag = 1
else
printf "j "
set $_j_flag = 0
end
# Data endianness bit (E), bit 9
if ($cpsr->e & 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->a & 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->i & 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->f & 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->t & 1)
printf "T "
set $_t_flag = 1
else
printf "t "
set $_t_flag = 0
end
# TODO: GE bit ?
end
document flagsarm
Auxiliary function to set ARM cpu flags.
end
define flagsx86
# OF (overflow) flag
if (($eflags >> 0xB) & 1)
printf "O "
set $_of_flag = 1
else
printf "o "
set $_of_flag = 0
end
# DF (direction) flag
if (($eflags >> 0xA) & 1)
printf "D "
else
printf "d "
end
# IF (interrupt enable) flag
if (($eflags >> 9) & 1)
printf "I "
else
printf "i "
end
# TF (trap) flag
if (($eflags >> 8) & 1)
printf "T "
else
printf "t "
end
# SF (sign) flag
if (($eflags >> 7) & 1)
printf "S "
set $_sf_flag = 1
else
printf "s "
set $_sf_flag = 0
end
# ZF (zero) flag
if (($eflags >> 6) & 1)
printf "Z "
set $_zf_flag = 1
else
printf "z "
set $_zf_flag = 0
end
# AF (adjust) flag
if (($eflags >> 4) & 1)
printf "A "
else
printf "a "
end
# PF (parity) flag
if (($eflags >> 2) & 1)
printf "P "
set $_pf_flag = 1
else
printf "p "
set $_pf_flag = 0
end
# CF (carry) flag
if ($eflags & 1)
printf "C "
set $_cf_flag = 1
else
printf "c "
set $_cf_flag = 0
end
printf "\n"
end
document 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
Print flags register.
end
define eflags
if $ARM == 1
printf " N <%d> Z <%d> C <%d> V <%d>",\
($cpsr->n & 1), ($cpsr->z & 1), \
($cpsr->c & 1), ($cpsr->v & 1)
printf " Q <%d> J <%d> GE <%d> E <%d> A <%d>",\
($cpsr->q & 1), ($cpsr->j & 1),\
($cpsr->ge), ($cpsr->e & 1), ($cpsr->a & 1)
printf " I <%d> F <%d> T <%d> \n",\
($cpsr->i & 1), ($cpsr->f & 1), \
($cpsr->t & 1)
else
printf " OF <%d> DF <%d> IF <%d> TF <%d>",\
(($eflags >> 0xB) & 1), (($eflags >> 0xA) & 1), \
(($eflags >> 9) & 1), (($eflags >> 8) & 1)
printf " SF <%d> ZF <%d> AF <%d> PF <%d> CF <%d>\n",\
(($eflags >> 7) & 1), (($eflags >> 6) & 1),\
(($eflags >> 4) & 1), (($eflags >> 2) & 1), ($eflags & 1)
printf " ID <%d> VIP <%d> VIF <%d> AC <%d>",\
(($eflags >> 0x15) & 1), (($eflags >> 0x14) & 1), \
(($eflags >> 0x13) & 1), (($eflags >> 0x12) & 1)
printf " VM <%d> RF <%d> NT <%d> IOPL <%d>\n",\
(($eflags >> 0x11) & 1), (($eflags >> 0x10) & 1),\
(($eflags >> 0xE) & 1), (($eflags >> 0xC) & 3)
end
end
document eflags
Print eflags register.
end
define cpsr
eflags
end
document cpsr
Print cpsr register.
end
define regarm
printf " "
echo \033[32m
printf "R0:"
if ($r0 != $oldr0 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r0
echo \033[32m
printf "R1:"
if ($r1 != $oldr1 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r1
echo \033[32m
printf "R2:"
if ($r2 != $oldr2 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r2
echo \033[32m
printf "R3:"
if ($r3 != $oldr3 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X\n", $r3
printf " "
echo \033[32m
printf "R4:"
if ($r4 != $oldr4 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r4
echo \033[32m
printf "R5:"
if ($r5 != $oldr5 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r5
echo \033[32m
printf "R6:"
if ($r6 != $oldr6 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r6
echo \033[32m
printf "R7:"
if ($r7 != $oldr7 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X\n", $r7
printf " "
echo \033[32m
printf "R8:"
if ($r8 != $oldr8 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r8
echo \033[32m
printf "R9:"
if ($r9 != $oldr9 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r9
echo \033[32m
printf "R10:"
if ($r10 != $oldr10 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r10
echo \033[32m
printf "R11:"
if ($r11 != $oldr11 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $r11
dumpjump
printf "\n"
echo \033[32m
printf " R12:"
if ($r12 != $oldr12 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X", $r12
printf " "
echo \033[32m
printf "SP:"
if ($sp != $oldsp && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $sp
echo \033[32m
printf "LR:"
if ($lr != $oldlr && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $lr
echo \033[32m
printf "PC:"
echo \033[0m
printf " 0x%08X ", $pc
echo \033[1m\033[4m\033[31m
flags
echo \033[0m
printf "\n"
end
document regarm
Auxiliary function to display ARM registers.
end
define regx64
# 64bits stuff
printf " "
# RAX
echo \033[32m
printf "RAX:"
if ($rax != $oldrax && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rax
# RBX
echo \033[32m
printf "RBX:"
if ($rbx != $oldrbx && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rbx
# RCX
echo \033[32m
printf "RCX:"
if ($rcx != $oldrcx && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rcx
# RDX
echo \033[32m
printf "RDX:"
if ($rdx != $oldrdx && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rdx
echo \033[1m\033[4m\033[31m
flags
echo \033[0m
printf " "
# RSI
echo \033[32m
printf "RSI:"
if ($rsi != $oldrsi && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rsi
# RDI
echo \033[32m
printf "RDI:"
if ($rdi != $oldrdi && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rdi
# RBP
echo \033[32m
printf "RBP:"
if ($rbp != $oldrbp && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rbp
# RSP
echo \033[32m
printf "RSP:"
if ($rsp != $oldrsp && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $rsp
echo \033[32m
printf "RIP:"
echo \033[0m
printf " 0x%016lX\n ", $rip
# R8
echo \033[32m
printf "R8 :"
if ($r8 != $oldr8 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $r8
# R9
echo \033[32m
printf "R9 :"
if ($r9 != $oldr9 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $r9
# R10
echo \033[32m
printf "R10:"
if ($r10 != $oldr10 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $r10
# R11
echo \033[32m
printf "R11:"
if ($r11 != $oldr11 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $r11
# R12
echo \033[32m
printf "R12:"
if ($r12 != $oldr12 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX\n ", $r12
# R13
echo \033[32m
printf "R13:"
if ($r13 != $oldr13 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $r13
# R14
echo \033[32m
printf "R14:"
if ($r14 != $oldr14 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX ", $r14
# R15
echo \033[32m
printf "R15:"
if ($r15 != $oldr15 && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%016lX\n ", $r15
echo \033[32m
printf "CS:"
echo \033[0m
printf " %04X ", $cs
echo \033[32m
printf "DS:"
echo \033[0m
printf " %04X ", $ds
echo \033[32m
printf "ES:"
echo \033[0m
printf " %04X ", $es
echo \033[32m
printf "FS:"
echo \033[0m
printf " %04X ", $fs
echo \033[32m
printf "GS:"
echo \033[0m
printf " %04X ", $gs
echo \033[32m
printf "SS:"
echo \033[0m
printf " %04X", $ss
echo \033[0m
end
document regx64
Auxiliary function to display X86_64 registers.
end
define regx86
printf " "
# EAX
echo \033[32m
printf "EAX:"
if ($eax != $oldeax && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $eax
# EBX
echo \033[32m
printf "EBX:"
if ($ebx != $oldebx && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $ebx
# ECX
echo \033[32m
printf "ECX:"
if ($ecx != $oldecx && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $ecx
# EDX
if ($edx != $oldedx && $SHOWREGCHANGES == 1)
echo \033[32m
printf "EDX:"
echo \033[31m
printf " 0x%08X ", $edx
else
echo \033[32m
printf "EDX:"
echo \033[0m
printf " 0x%08X ", $edx
end
echo \033[1m\033[4m\033[31m
flags
echo \033[0m
printf " "
# ESI
echo \033[32m
printf "ESI:"
if ($esi != $oldesi && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $esi
# EDI
echo \033[32m
printf "EDI:"
if ($edi != $oldedi && $SHOWREGCHANGES == 1)
echo \033[31m
else
echo \033[0m
end
printf " 0x%08X ", $edi
# EBP
echo \033[32m
printf "EBP:"
if ($ebp != $oldebp && $SHOWREGCHANGES == 1)
echo \033[31m
else