This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/20926] New: gdb misses breakpoint and stops one line after


https://sourceware.org/bugzilla/show_bug.cgi?id=20926

            Bug ID: 20926
           Summary: gdb misses breakpoint and stops one line after
           Product: gdb
           Version: 7.7
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: jerry.marbas at gmail dot com
  Target Milestone: ---

I am trying to debug a simple assembly language program in gdb and setting a
breakpoint at the _start label(line 5), but when I run it, the program stops
one line after on line 6, not on line 5.

I cannot find the reason for this behaviour on google or from my searches on
the Raspbian bug database.

To repeat the steps below, run the program on a Raspberry Pi 3 running Raspbian
8.0 Jessie and gdb version 7.7.1

1 @filename: P2_1.s -- program adds contents of two registers together.
2 
3 .text
4 .global _start
5 _start:  MOV R1, #0x25     @storing 25 hex in R1
6          MOV R2, #0x34     @storing 34 hex in R2
7          ADD R3, R2, R1    @adding R1 and R2
8 HERE:   B   HERE           @infinite loop
9 .end    
Compile and link including debug symbols like this:

$ as -g -o P2_1.o P2_1.s; ld -o P2_1 P2_1.o
Then run gdb like this:

$ gdb P2_1
Then in gdb add a breakpoint at the _start label like this:

(gdb) break _start
Breakpoint 1 at 0x10058: file P2_1.s, line 6.

The breakpoint is added to line 6 not line 5. When you run it, it should stop
at line 5, but it doesnt. It stops at line 6.

I posted this issue on stackexchange but maybe that wasnt the right place for
it so Im submitting a bug report about it here.

http://raspberrypi.stackexchange.com/questions/58437/gdb-misses-breakpoint-and-stops-one-line-after

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]