简体   繁体   English

汇编程序在GDB中找不到调试符号

[英]Assembly program no debugging symbols found in GDB

So my first foray into Assembly. 所以我第一次涉足组装。 I have a demo program that is just setting some values and then moving them between memory locations and registers. 我有一个演示程序,它只是设置一些值,然后在存储位置和寄存器之间移动它们。 Simples. Simples。

The problem is when I try to analyse the program in gdb I get this error: 问题是当我尝试分析gdb的程序时出现此错误:

Reading symbols from DataTypes... (no debugging symbols found)... done . Reading symbols from DataTypes... (no debugging symbols found)... done

GDB is configures as i686-linux-gnu and running on Kali Linux in a Windows 10 hosted VMWare instance. GDB配置为i686-linux-gnu并在Windows 10托管的VMWare实例中的Kali Linux上运行。 uname -a: Linux Kali 4.17.0-kali1-686-pae #1 SMP Debian 4.17.8-1kali1 (2018-07-04) i686 GNU Linux . uname -a: Linux Kali 4.17.0-kali1-686-pae #1 SMP Debian 4.17.8-1kali1 (2018-07-04) i686 GNU Linux

My Code... 我的代码...

# Demo program to show how to use Data types and MOVx instructions 

.data 

    HelloWorld:
        .ascii "Hello World!"

    ByteLocation:
        .byte 10

    Int32:
        .int 2
    Int16:
        .short 3
    Float:
        .float 10.23

    IntegerArray:
        .int 10,20,30,40,50


.bss
    .comm LargeBuffer, 10000

.text 

    .globl _start

    _start:

        nop

        # 1. MOV immediate value into register 

        movl $10, %eax

        # 2. MOV immediate value into memory location 

        movw $50, Int16

        # 3. MOV data between registers 

        movl %eax, %ebx


        # 4. MOV data from memory to register 

        movl Int32, %eax 

        # 5. MOV data from register to memory 

        movb $3, %al
        movb %al, ByteLocation

        # 6. MOV data into an indexed memory location 
        # Location is decided by BaseAddress(Offset, Index, DataSize)
        # Offset and Index must be registers, Datasize can be a numerical value 

        movl $0, %ecx
        movl $2, %edi
        movl $22, IntegerArray(%ecx,%edi , 4)

        # 7. Indirect addressing using registers 

        movl $Int32, %eax
        movl (%eax), %ebx

        movl $9, (%eax)



        # Exit syscall to exit the program 

        movl $1, %eax
        movl $0, %ebx
        int $0x80

So as per suggestion by Jester 所以根据小丑的建议

I reran the compilation with as using the -g flag. 我重新用编译as使用-g标志。

as -g -o DataTypes.o DataTypes.s

Linked ld -o DataTypes DataTypes.o 链接的ld -o DataTypes DataTypes.o

Ran GDB 冉GDB

gdb ./DataTypes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM