[lldb-dev] here need your help

Greg Clayton gclayton at apple.com
Fri Jan 3 10:30:41 PST 2014


I am not sure why x86_32 would fail as I have never dealt with that platform. I know that when we set a breakpoint in the debuggee, we put a "INT" instruction (0xcc) into the program. I am not sure if x86_32 does anything differently with the 0xcc traps.

You might try and place a:

__builtin_trap()

into your code:

#include <stdio.h>
int main()
{
    for(int i=0 ;i<2;i++)
    {
        printf ("hello world\n");
    }
    __builtin_trap();
    return 0; 
}

then compile and debug it. If the debugger stops at the builtin_trap, then at least we know the breakpoint opcode should trigger the process to stop.

% clang -g -O0 -o helloworld helloworld.c
% lldb helloworld
The other thing you can do is attach the output of the following commands:

(lldb) b helloworld.c:7
(lldb) b
(lldb) target list

I might be able to tell more if you attach the output to the LLDB commands above...

Greg


On Jan 2, 2014, at 8:50 PM, liu chao jun <amiko212 at 126.com> wrote:

> Thank you very much ,And i have tried it on my computer ,however ,it seems fail too ,what's more , As the llvm  offical web site ,it seems support X86_64 not x86_32 ,For my Operation Systerm is ubuntu x86_32 , And i also try in ubuntu x86_64 ,And it success , it is my fail reason ?  Thank your much ! And looking forward to your reply . 
> 
> 
> 
> 
> 
> 
> At 2014-01-03 03:11:22,"Greg Clayton" <gclayton at apple.com> wrote:
> >You did everything correctly. My guess is you didn't supply -O0 on your compile line and the compiler optimized your code. When the compiler optimizes your code, the line numbers and debug info are not very useful due the the optimizations.
> >
> >Try compiling with:
> >
> >% clang -g -O0 -o helloworld helloworld.c
> >
> >And try again.
> >
> >Greg
> >
> >On Dec 24, 2013, at 11:45 PM, liu chao jun <amiko212 at 126.com> wrote:
> >
> >>  hi all ,
> >>      This is amiko who is a new lldb user ,There is same questions  need your help 
> >> 1, Can lldb  debug C/C++ project .ext file directly  like gdb or not ? 
> >> 2 ,Here is a simple c project named helloword  the detail source please follow below:
> >> 
> >> // helloworld.c \
> >> 1 #include <stdio.h>
> >> 2 int main()
> >> 3 {
> >> 4     int i  ;
> >> 5     for(i=0 ;i<2;i++)
> >> 6    {
> >> 7       printf ("hello world\n");
> >> 8    }
> >> 9      return 0 ; 
> >> 10 }
> >> my step is 
> >> 1 clang -g -o helloworld helloworld.c
> >> 2 $then compile and debug it:
> >> 3<lldb> b hellowold.c:7
> >> 4 run 
> >> I think it will pause in line 7 .however it seems fail ,and print two hello world , In other word setting breakpoint operation does not useful . Is any error or fault for my operations ,Thank you very much ,And looking forward to your reply ,Thanks again .  
> >> 
> >> 
> >> 
> >> 
> >> 
> >> _______________________________________________
> >> lldb-dev mailing list
> >> lldb-dev at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> >
> 
> 
> 




More information about the lldb-dev mailing list