gdb

In GDB how do I print 0xc(%rsp)?

╄→гoц情女王★ 提交于 2021-02-11 07:31:29
问题 I'm trying to debug some code for a project and I've come up against this line cmpl $0x7,0xc(%rsp) . What is 0xc(%rsp), and how do I print it? 回答1: What is 0xc(%rsp) The memory location 12 bytes above current stack pointer. The value at that location is being compared with 7 . and how do I print it? (gdb) print $rsp+0xc 来源: https://stackoverflow.com/questions/16212339/in-gdb-how-do-i-print-0xcrsp

In GDB how do I print 0xc(%rsp)?

喜欢而已 提交于 2021-02-11 07:31:10
问题 I'm trying to debug some code for a project and I've come up against this line cmpl $0x7,0xc(%rsp) . What is 0xc(%rsp), and how do I print it? 回答1: What is 0xc(%rsp) The memory location 12 bytes above current stack pointer. The value at that location is being compared with 7 . and how do I print it? (gdb) print $rsp+0xc 来源: https://stackoverflow.com/questions/16212339/in-gdb-how-do-i-print-0xcrsp

How can I show gdb to show my variables properly?

半城伤御伤魂 提交于 2021-02-10 20:17:14
问题 For example I have a simple substring class and a simple array. When I'm debugging it's a headache because I need many clicks just to get some kind of sensible information. Is there a way I can markup my source of have some kind of config that says when I print the variable a I actually mean p *a.start@(a.end-a.start) When I exam array I'd like it to show the variable in the style above ( p *arr.array@arr.pos is a mess) Current GDB output $ gdb ./a.out (gdb) br a.cpp:38 Breakpoint 1 at 0x128f

BIOS int 0x13 modifies CS:IP?

陌路散爱 提交于 2021-02-10 15:46:55
问题 I'm writing an x86 bootloader which occupies two sections (1024 bytes) on disk and the first thing I want it to do is to load both sections to segment 0x60 before continuing execution Here is the relocation part of my code: _start: // relocate and load remaining bootloader code mov $0x60, %ax mov %ax, %es mov $0x02, %ah mov $2, %al xor %bx, %bx mov $0, %ch mov $2, %cl xor %dh, %dh int $0x13 jmp $0x60, $reloc_done reloc_done: // set up segment registers mov $0x60, %ax mov %ax, %ds mov %ax, %es

How do I perform a remote gdb session on a PC for ARM gdbserver WITH GDB GUI frontend?

情到浓时终转凉″ 提交于 2021-02-10 13:16:20
问题 I am using Ubuntu 16.04 on x86_64 workstation, and I'm cross-compiling a small demo program in C++, and deploying it to an embedded linux target running ARM architecture ( environment-setup-cortexa9hf-neon-poky-linux-gnueabi , arm-poky-linux-gnueabi-g++ ). I am able to successfully do this which gives me a debug session on commandline: Target: rpm -ivh gdbserver-7.10.1-r0.cortexa9hf_neon.rpm gdbserver :9091 ${APPNAME} Host: sudo apt-get install gdb-multiarch gdb-multiarch $APPNAME target

How do I perform a remote gdb session on a PC for ARM gdbserver WITH GDB GUI frontend?

戏子无情 提交于 2021-02-10 13:15:52
问题 I am using Ubuntu 16.04 on x86_64 workstation, and I'm cross-compiling a small demo program in C++, and deploying it to an embedded linux target running ARM architecture ( environment-setup-cortexa9hf-neon-poky-linux-gnueabi , arm-poky-linux-gnueabi-g++ ). I am able to successfully do this which gives me a debug session on commandline: Target: rpm -ivh gdbserver-7.10.1-r0.cortexa9hf_neon.rpm gdbserver :9091 ${APPNAME} Host: sudo apt-get install gdb-multiarch gdb-multiarch $APPNAME target

Printf arguments not pushed on the stack

蹲街弑〆低调 提交于 2021-02-10 13:15:26
问题 I'm in the process of trying to understand the stack mechanisms. From the theory I have seen, before a function is called, its arguments are pushed onto the stack. However when calling printf in the code below, none of them are pushed: #include<stdio.h> int main(){ char *s = " test string"; printf("Print this: %s and this %s \n", s, s); return 1; } I've put a break in gdb to the printf instruction, and when displaying the stack, none of the 3 arguments are pushed onto the stack. The only

How do I perform a remote gdb session on a PC for ARM gdbserver WITH GDB GUI frontend?

匆匆过客 提交于 2021-02-10 13:14:54
问题 I am using Ubuntu 16.04 on x86_64 workstation, and I'm cross-compiling a small demo program in C++, and deploying it to an embedded linux target running ARM architecture ( environment-setup-cortexa9hf-neon-poky-linux-gnueabi , arm-poky-linux-gnueabi-g++ ). I am able to successfully do this which gives me a debug session on commandline: Target: rpm -ivh gdbserver-7.10.1-r0.cortexa9hf_neon.rpm gdbserver :9091 ${APPNAME} Host: sudo apt-get install gdb-multiarch gdb-multiarch $APPNAME target

Printf arguments not pushed on the stack

筅森魡賤 提交于 2021-02-10 13:11:26
问题 I'm in the process of trying to understand the stack mechanisms. From the theory I have seen, before a function is called, its arguments are pushed onto the stack. However when calling printf in the code below, none of them are pushed: #include<stdio.h> int main(){ char *s = " test string"; printf("Print this: %s and this %s \n", s, s); return 1; } I've put a break in gdb to the printf instruction, and when displaying the stack, none of the 3 arguments are pushed onto the stack. The only

Printf arguments not pushed on the stack

放肆的年华 提交于 2021-02-10 13:09:03
问题 I'm in the process of trying to understand the stack mechanisms. From the theory I have seen, before a function is called, its arguments are pushed onto the stack. However when calling printf in the code below, none of them are pushed: #include<stdio.h> int main(){ char *s = " test string"; printf("Print this: %s and this %s \n", s, s); return 1; } I've put a break in gdb to the printf instruction, and when displaying the stack, none of the 3 arguments are pushed onto the stack. The only