make lldb work

Sorry if asked before.

I’m new to LLDB, try to use it according to the lldb project site. I write some very simple code like:

#include <stdio.h>

int main(int argc, char **argv)
{
int counter = 0;
while ( counter < 10 )
counter++;

printf(“counter: %d\n”, counter);

return 0;
}

and the session like:

$ clang -g main.c
$ lldb-3.4 a.out
(lldb) breakpoint set -l 8

(lldb) breakpoint set -l 12

(lldb) breakpoint list

(lldb) process launch

Process 1105 launched: ‘/home/maple/debug/arena/a.out’ (i386)
counter: 10
Process 1105 exited with status = 0 (0x00000000)

I checked with gdb, it works well. I’m not sure whether it’s a bug or my false command.

I’m using Ubuntu 12.04, and the lldb is from llvm.org/apt. It’s svn186357.

Hi,

I notice you're running a 32-bit program; are you also on a 32-bit host, or do you have a 64-bit OS installed? We don't generally test on 32-bit hosts, so it's possible you found a new bug. In addition, there are some known bugs with debugging 32-bit programs (even on 64-bit hosts) which will we hopefully be resolving soon.

Nonetheless, I was unable to reproduce the behaviour you reported (with lldb-3.4 Ubuntu package version r186406). What's the output of "breakpoint list" -- does LLDB resolve any address for the breakpoint?

Here is my LLDB session on a 64-bit host debugging a 32-bit program:

daniel@lautrec:~$ lldb ./a.out
Current executable set to './a.out' (i386).
(lldb) breakpoint set -l 8
Breakpoint 1: where = a.out`main + 67 at bla.cpp:9, address = 0x080484f3
(lldb) breakpoint set -l 12
Breakpoint 2: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) breakpoint list
Current breakpoints:
1: file = '/home/daniel/bla.cpp', line = 8, locations = 1
  1.1: where = a.out`main + 67 at bla.cpp:9, address = 0x080484f3, unresolved, hit count = 0

2: file = '/home/daniel/bla.cpp', line = 12, locations = 0 (pending)

(lldb) process launch
Process 22954 launched: './a.out' (i386)
Process 22954 stopped
* thread #1: tid = 0x59aa, 0x080484f3 a.out`main(argc=1, argv=0xffa37624) + 67 at bla.cpp:9, name = 'a.out, stop reason = breakpoint 1.1
    frame #0: 0x080484f3 a.out`main(argc=1, argv=0xffa37624) + 67 at bla.cpp:9
   6 while ( counter < 10 )
   7 counter++;
   8
-> 9 printf("counter: %d\n", counter);
   10
   11 return 0;
   12 }
(lldb)

The host is a 32-bit box, and the debug program is 32-bit as well. The breakpoint list command works well. Actually, I’ve compiled lldb from source, which doesn’t change the situation. So this is very possible a 32-bit bug.

I think I should find a 64-bit Linux box, and try again. And I may also try to locate the problem, which will take some time, since I’m new to this.