0

I learn to write code in NASM, and wrote the following program:

bits    64

section .text
global _start

_start:   

        mov eax, 60
        mov edi, 0
        syscall

Also I use this Makefile to compile it:

S = /usr/bin/nasm
LD = /usr/bin/ld

ASFLAGS = -g -f elf64
LDFLAGS = -static

SRCS = lab.s
OBJS = $(SRCS:.s=.o)

EXE = lab

all: $(SRCS) $(EXE)

clean:
        rm -rf $(EXE) $(OBJS)

$(EXE): $(OBJS)
        $(LD) $(LDOBJS) $(OBJS) -o $@

.s.o:
        $(AS) $(ASFLAGS) $< -o $@

It works good and I even can run it, but when I try to use gdb to debug it, I've got this:

error: pc 0x401000 in address map, but not in symtab.

I checked my GDB version and even updated it:

GNU gdb (GDB) 13.1 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

I installed peda plugin, but errors still occur.

I googled this, but only one special advice I've got is to check my version/

What shall I do to fix this?

My system is:

Static hostname: MyPC
       Icon name: computer-laptop
         Chassis: laptop 
      Machine ID: ...
         Boot ID: ...
Operating System: Arch Linux                      
          Kernel: Linux 6.2.2-arch1-1
    Architecture: x86-64
Firmware Version: V1.11
   Firmware Date: Tue 2020-10-13

Stepan
  • 1
  • 2

1 Answers1

0

My teacher helped me solve this problem. It turned out, that my nasm version (2.15) conflicts with my gdb version (13.1). There was no newer version in the official Arch Linux repository, so I had to download it manually. And now it works: gdb (13.1) and nasm (2.16)

Stepan
  • 1
  • 2