NevemTeve
2023.09.19
0 0
64
@ módosító tömbelemek kiírására:
(gdb) print *argv@4 $4 = {0x7fffffffe16f "/home/teve/proba/echo", 0x7fffffffe18e "elso", 0x7fffffffe193 "masodik", 0x7fffffffe19b "har madik"}
NevemTeve
2023.06.18
0 0
63
print milyen hosszan írja ki a stringeket:
set print elements n
default=200, 0=unlimited
NevemTeve
2020.04.15
0 0
59
Aztán itt van a catch syscall : álljon meg bármilyen rendszerhívásnál. Tovább opciók:
(gdb) help catch Set catchpoints to catch events. List of catch subcommands: catch assert -- Catch failed Ada assertions catch catch -- Catch an exception catch exception -- Catch Ada exceptions catch exec -- Catch calls to exec catch fork -- Catch calls to fork catch handlers -- Catch Ada exceptions catch load -- Catch loads of shared libraries catch rethrow -- Catch an exception catch signal -- Catch signals by their names and/or numbers catch syscall -- Catch system calls by their names catch throw -- Catch an exception catch unload -- Catch unloads of shared libraries catch vfork -- Catch calls to vfork
NevemTeve
2018.08.14
0 0
55
Feltételes breakpoint:
b xcoffread.c:1128 if cs->c_symnum==688
commands
printf "name="%s" symnum=%d naux=%d sclass=%d secnum=%d type=%d\n", cs->c_name, cs->c_symnum, cs->c_naux, cs->c_sclass, cs->c_secnum, cs->c_type
end
Előzmény: NevemTeve (54)
NevemTeve
2017.11.22
0 0
51
További info -k összes változó, lokális változók, paraméterek:
info variables
info locals
info args
NevemTeve
2016.08.19
0 0
47
Szintén gépikód szintű információ az 'info line'
(gdb) info line Line 7 of "hello.c" starts at address 0x80483ed <main+9> and ends at 0x80483f9 <main+21>.
Előzmény: NevemTeve (46)
NevemTeve
2016.08.19
0 0
46
A disass /m main pedig belevegyíti a forrásprogramot is:
(gdb) disass /m main Dump of assembler code for function main: 6 { 0x080483e4 <+0>: push %ebp 0x080483e5 <+1>: mov %esp,%ebp 0x080483e7 <+3>: and $0xfffffff0,%esp 0x080483ea <+6>: sub $0x10,%esp 7 puts ("hello"); 0x080483ed <+9>: movl $0x80484c0,(%esp) 0x080483f4 <+16>: call 0x8048300 <puts@plt> 8 return 0; 0x080483f9 <+21>: mov $0x0,%eax 9 } 0x080483fe <+26>: leave 0x080483ff <+27>: ret End of assembler dump.
Előzmény: NevemTeve (22)
NevemTeve
2016.05.05
0 0
44
Namostan lehet, hogy a hívott nem állítja az EBP-t, akkor:
(gdb) x/4x $esp+8 # paraméterek
(gdb) print ((char **)$esp)[1] # 1. param (ha string)
(gdb) print ((int32_t *)$esp)[2] # 2. param (ha integer)
Előzmény: NevemTeve (31)
NevemTeve
2016.04.21
0 0
43
Hol a csodában járunk is most?
(gdb) p/x $pc $6 = 0x7ffff4f36271
(gdb) x $pc 0x7ffff4f36271 <lp_state_directory+4>: 0xd8058d48
(gdb) info symbol $pc lp_state_directory + 4 in section .text of /local/usr/local/src/samba-4.4.2/bin/shared/libsmbconf.so.0
NevemTeve
2016.03.03
0 0
42
Speciel most csak így működött (másik gép, másik OS, másik verzió?):
$ gdb program
(gdb) set exec-wrapper env 'LD_PRELOAD=/home/projects/lib64/libmemtrace.so'
(gdb) run
Előzmény: NevemTeve (29)
NevemTeve
2015.08.11
0 0
38
Ha hosszú a parancs kimenete:
(gdb) set logging on
Copying output to gdb.txt. (gdb) info sh # vagy amit gondolunk
(gdb) set logging off
NevemTeve
2013.11.15
0 0
35
Ha esetleg még az intel rabigájában nyögünk:
(gdb) set disassembly-flavor intel
Ha kedveled azért, ha nem azért nyomj egy lájkot a Fórumért!