GDB - Breakpoint address adjusted warning

Viewed 153

I'm learning assembly (GAS) language and using gdb to debug my programs (OS Ubuntu 18.04 x64).

I used this command to create x86 executable file:

gcc -g -m32 -nostdlib -o "prog" "prog.s"

Next I run gdb -q prog, set breakpoint with break line-number and run. And all was working till gcc-update (I think so). Now with updated gcc (7.4.0) after running gdb -q prog I get this warning and program hangs:

Starting program: /home/test/asm/prog 
warning: Breakpoint address adjusted from 0xf7fe5db0 to 0xfffffffff7fe5db0.
^C
Program received signal SIGINT, Interrupt.
0xf7fe5db0 in _dl_debug_state () from /lib/ld-linux.so.2
(gdb) quit
A debugging session is active.

    Inferior 1 [process 9600] will be killed.

Quit anyway? (y or n) y

Can someone advice please? What happened and why can't I use gcc anymore to create x86 executables?

Now, to use gdb I create x86 executable using these lines:

as --32 --gstabs "prog.s" -o "prog.o"
ld -m elf_i386 "prog.o" -o "prog"

Next I use gdb -q prog and everything works fine: I set breakpoints, run program and it stops at breakpoints without warnings and hanging.

I tried this at several assembly examples, even the simpliest one as this:

.section .text
.globl _start
_start:
movl $0, %ebx
movl $1, %eax
int $0x80

And even here I get breakpoint adjusted warning and program hangs in gdb...

I did not try previous version of gcc, because I don't know how to install it.

Tried sudo apt-get install gcc=4:7.3.0-3ubuntu2, but gcc --version shows latest - 4.7.4.

I think it is because gcc is a symbolic link at /usr/bin/gcc which points to /usr/bin/gcc-7 which has version 7.4.0.

dpkg -l | grep gcc

ii  gcc                                        4:7.3.0-3ubuntu2                             amd64        GNU C compiler
ii  gcc-7                                      7.4.0-1ubuntu1~18.04.1                       amd64        GNU C compiler
ii  gcc-7-base:amd64                           7.4.0-1ubuntu1~18.04.1                       amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-7-multilib                             7.4.0-1ubuntu1~18.04.1                       amd64        GNU C compiler (multilib support)
ii  gcc-8-base:amd64                           8.3.0-6ubuntu1~18.04.1                       amd64        GCC, the GNU Compiler Collection (base package)
ii  lib32gcc-7-dev                             7.4.0-1ubuntu1~18.04.1                       amd64        GCC support library (32 bit development files)
ii  lib32gcc1                                  1:8.3.0-6ubuntu1~18.04.1                     amd64        GCC support library (32 bit Version)
ii  libgcc-7-dev:amd64                         7.4.0-1ubuntu1~18.04.1                       amd64        GCC support library (development files)
ii  libgcc1:amd64                              1:8.3.0-6ubuntu1~18.04.1                     amd64        GCC support library
ii  libx32gcc-7-dev                            7.4.0-1ubuntu1~18.04.1                       amd64        GCC support library (x32 development files)
ii  libx32gcc1                                 1:8.3.0-6ubuntu1~18.04.1                     amd64        GCC support library (x32)

And command sudo apt-get install gcc-7=7.3.0-16ubuntu3 failed with errors:

The following packages have unmet dependencies:
 gcc-7 : Depends: cpp-7 (= 7.3.0-16ubuntu3) but 7.4.0-1ubuntu1~18.04.1 is to be installed
         Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.4.0-1ubuntu1~18.04.1 is to be installed
         Depends: libgcc-7-dev (= 7.3.0-16ubuntu3) but 7.4.0-1ubuntu1~18.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

Please, give me advice, why can't I debug executable generated from gcc? I've used objdump -D on executables from ld and gcc. They are different, but I don't know how it can help me.

0 Answers
Related