[Go] GDB disassemble

Source: Internet
Author: User

The previous few talk about GDB Debug program's post, all to disassembly vague. Here's a detailed discussion of the Disassemble/disass command.

Disassembly a function
Disass Func_name

Disassemble a memory address, the 1th parameter is the start address, and the 2nd is the terminating address
Disassemble 0x0 0x10

First look at document debugging with GDB
Http://sourceware.org/gdb/download/onlinedocs/gdb.html
Source and Machine code
You can use the info command to map a source line to a program address, and then use the command disassemble to display a machine instruction for an address range.
For example, I want to see where the main function starts.

(GDB) Info Line Main
Line ' RANK.C ' starts at address 0x804847f
and ends at 0x8048493.
(GDB) Info line *0x804847f
Line ' RANK.C ' starts at address 0x804847f
and ends at 0x8048493.
Also, Info line modifies the default start address of the x/i command

Disassemble with no parameters, the default disassembly range is the function near the PC of the selected frame
A single parameter is a PC, and of course it can be a function name, because the function name is also an address; So the range is the function near the PC.
Two parameters, which is the memory address range

Set Disassembly-flavor Intel formats the assembly instruction in Intel format, the default is ATT
(GDB) Show Disassembly-flavor
The disassembly flavor is "att".

Next breakpoint:

b *0x00007fffab642

Another way to view disassembly instructions is to use X
X/3i $pc

X/100U $pc
3 Instructions for displaying PC start

Single Step Execution:

Si

Single-Line execution:

Ni

[Go] GDB disassemble

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.