Stack Frame Layout
Stack Tracing Layout
This residue is symbolic information left in a stack region, including ASCII and UNICODE fragments or pointers to them, for example, return addresses from past function calls:
x/512a $rsp-2000
x command
x command
Displays the memory contents at a given address using the specified format.
Syntax
x [Address expression] x /[Format] [Address expression] x /[Length][Format] [Address expression] x
Parameters
Address expression
Specifies the memory address which contents will be displayed. This can be the address itself or any C/C++ expression evaluating to address.
The expression can include registers (e.g. $eip) and pseudoregisters (e.g. $pc). If the address expression is not specified,
the command will continue displaying memory contents from the address where the previous instance of this command has finished.
Format
If specified, allows overriding the output format used by the command. Valid format specifiers are:
o - octal
x - hexadecimal
d - decimal
u - unsigned decimal
t - binary
f - floating point
a - address
c - char
s - string
i - instruction
The following size modifiers are supported:
b - byte
h - halfword (16-bit value)
w - word (32-bit value)
g - giant word (64-bit value)
Length
Specifies the number of elements that will be displayed by this command.
symbol-file app.debug
加载app的debug符号文件
info sharedlibrary
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x00007ffff7fc5090 0x00007ffff7fee335 Yes /lib64/ld-linux-x86-64.so.2
maintenance info sections
(gdb) maintenance info sections
Exec file: `/root/code/debuging/a.out', file type elf64-x86-64.
[0] 0x555555554318->0x555555554334 at 0x00000318: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
[1] 0x555555554338->0x555555554368 at 0x00000338: .note.gnu.property ALLOC LOAD READONLY DATA HAS_CONTENTS
........
dump memory FILE START END
set logging file FILEPATH
Tips
set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set demangle-style gnu-v3
set print sevenbit-strings off
set backtrace past-main 显示main函数之前的堆栈
ptov 物理地址转换为虚拟地址
sym ADDRESS 查看这个地址对应的符号
crash> sym ffffffff9047f24d
ffffffff9047f24d (T) panic+273 debian/build/build_amd64_none_amd64/arch/x86/include/asm/smp.h: 62
dis -l ADDRESS 打印对应地址的汇编表示和对应行号
crash> dis -l ffffffff9047f24d
debian/build/build_amd64_none_amd64/arch/x86/include/asm/smp.h: 62
0xffffffff9047f24d <panic+273>: mov 0xdaaec4(%rip),%rax # 0xffffffff9122a118 <smp_ops+24>