Why are set breakpoints not being hit in LLDB for my arm assembly code

0

I'll start by listing everything I've done and observed behavior.

.data

.balign 4
foo:
  .word 0

.balign 4
foo:
    .word 0

/* -- Code section */
.text

/* Ensure function section starts 4 byte aligned */
.balign 4
.global main
main:
    ldr r1, #40
    mov r0, =foo
    str r1, [r0]

    ldr r3, #2
    mov r2, =bar
    str r3, [r2]


    ldr r0, =foo
    ldr r1, =bar
    ldr r2, [r0]
    ldr r3, [r1]
    add r0, r1, r2

    mov r2, #12
    mov r7, #1
    swi 0

Then I compile and link like so

$> as -g store01.s -o store01.o
$> ld store01.o -o store01

Then launch lldb:

$> lldb store01

I've set breakpoints the following ways:

(lldb) breakpoint set --name _start
(lldb) breakpoint set --address 0x10078

I have successfully looked at the disassembly using addresses

(lldb) disassemble --start-address 0x10078 --end-address 0x10090

However when i do

(lldb) process launch

I hit no breakpoints and get the following

Process 20966 launched: 'pathto/store01' (arm)
(lldb) Process 20966 exited with status = 42 (0x0000002a)
/* blank line with cursor blinking on it */

It seems strange to me that the string "Process 20966 exited ..." is placed after the lldb command prompt, and that the prompt is waiting for input.

The debugging session is done through SSH to a raspberry pi.

So, anyone have any ideas or know why the breakpoints are not being hit?


In response to requests for more information

$>  lldb store01
(lldb) image lookup -vn _start
1 match found in /somepath/store01:
      Address: store01[0x00010074] (store01...text+0)
      Summary: store01`
       Module: file = "/somepath/store01", arch="arm"
 Compile Unit: id = {0x00000000}, file = "/somepath/store01.s", language = "mipsassem"
LineEntry: [x00010074-0x00010078): /somepath/store01.s:15
Symbol: id = {0x00000001}, range = [0x00010074-0x000200b4)

And when I run

(lldb) target modules dump symtab

I see that _start is in this symbol table

When I run

(lldb) image lookup --verbose --address 0x10078

It is similar to the above and uses _store` + 4


Here is some more interesting behavior I set the breakpoint for the symbol _start. No breakpoints are hit. I try again using the address. No breakpoints are hit. I try again using the address of _start + 8. No breakpoints are hit. I delete the first two breakpoints. A breakpoint is hit.

(lldb) breakpoint set --name _start
Breakpoint 1: where = store01` + 4, address = 0x00010078
(lldb) process launch
Process 2983 launched: '/path/store01' (arm)
(lldb) Process 2893 exited with status = 42 (0x0000002a)
breakpoint set --address 0x00010078
Breakpoint 2: where = store01` + 4, address = 0x00010078
(lldb) process launch
Process 2910 launched: '/path/store01' (arm)
(lldb) Process 2910 exited with status = 42 (0x0000002a)
breakpoint set --address 0x0001007c
Breakpoint 3: where = store01` + 8, address = 0x0001007c
(lldb) process launch
Process 2927 launched: '/path/store01' (arm)
(lldb) Process 2910 exited with status = 42 (0x0000002a)
(lldb) breakpoint delete 1 2
2 breakpoints deleted; 0 breakpoint locations disabled.
(lldb) process launch
Process 2944 launched: '/path/store01' (arm)
Process 2944 stopped

This must be some form of misbehavior.

assembly
raspberry-pi
arm
breakpoints
lldb
asked on Stack Overflow Aug 7, 2018 by Jon Plotner • edited Aug 10, 2018 by Jon Plotner

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0