RE: "xbreak" command in GDB ?

Sarnath K - CTD, Chennai.
2002-01-25T08:24:49Z

Hi,

The following is the session demonstrating
failure of "xbreak" on GDB Version 5.1 (for i386), running
on Linux kernel 2.4.0/Pentium III. GDB was configured
for "i686-pc-linux-gnu".

Source:

[root@boost /tmp]# cat xbreak.c
int main()
{
a();
}

int a()
{
int i=0, j=0;

return 0;
}

Compilation:

[root@boost /tmp]# cc -g -o xbreak xbreak.c

Debug session:

[root@boost /tmp]# ./gdb ./xbreak
GNU gdb 5.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) xbreak a
Breakpoint 1 at 0x80483c6
(gdb) run
Starting program: /tmp/./xbreak

Program exited normally.
(gdb) disassemble a
Dump of assembler code for function a:
0x80483ac : push %ebp
0x80483ad <a+1>: mov %esp,%ebp
0x80483af <a+3>: sub $0x8,%esp
0x80483b2 <a+6>: movl $0x0,0xfffffffc(%ebp)
0x80483b9 <a+13>: movl $0x0,0xfffffff8(%ebp)
0x80483c0 <a+20>: xor %eax,%eax
0x80483c2 <a+22>: jmp 0x80483c4 <a+24>
0x80483c4 <a+24>: leave
0x80483c5 <a+25>: ret
End of assembler dump.

Conclusion:
The "xbreak" command says that it has set the bkpt at
0x80483c6. But the disassembly says that the last instruction
(ret) is at location 0x80483c5. Is this a bug ?

Thanks,
Sarnath