osx - Weird lldb behavior (comparing to gdb) C -
i come freebsd , i'm used debug gdb, unfortunately, gdb not natif on macbook, wanted debug using lldb.
unfortunately, don't understand weird behavior :
when launch c program , breakpoint on 1 function, , launch using "run", go breakpoint appears can read through in assembly code = hard debuging, not in gdb straight line line => easy debuging
look @ .c, (i know code awful it's not point, it's trying set lldb properly)
int ft_count_point(char *m, int i) { int count; int count_c; count = 0; count_c = 0; while (m[i] != '\0' || (m[i] != '\n' && m[i + 1] != '\n')) { if (m[i] == '.') { count_c++; count++; } if (m[i] == '\n' || m[i] == '#') count++; i++; } if (count != 20 && count_c != 16) return (1); exit (0); } the main function contains call on fonction , return 0.
look @ using lldb breakpoint on ft_count_point:
(lldb) target create "./a.out" current executable set './a.out' (x86_64). (lldb) settings set -- target.run-args "tests/error1" (lldb) b ft_count_point breakpoint 1: = a.out`ft_count_point + 35 @ ft_count_point.c:5, address = 0x00000001000073e3 (lldb) r process 17302 launched: './a.out' (x86_64) addresssanitizer debugger support active. memory error breakpoint has been installed , can use 'memory history' command. process 17302 stopped * thread #1: tid = 0x43c1e7, 0x00007fff5fc01000 dyld`_dyld_start, stop reason = exec frame #0: 0x00007fff5fc01000 dyld`_dyld_start dyld`_dyld_start: -> 0x7fff5fc01000 <+0>: popq %rdi 0x7fff5fc01001 <+1>: pushq $0x0 0x7fff5fc01003 <+3>: movq %rsp, %rbp 0x7fff5fc01006 <+6>: andq $-0x10, %rsp i can go step step seriously, it's waste of time.
looks program re-exec's - maybe asan doing you? can see in lldb output, says:
* thread #1: tid = 0x43c1e7, 0x00007fff5fc01000 dyld`_dyld_start, stop reason = exec if had hit breakpoint, reason stop reason = breakpoint 1.1 or whatever breakpoint number appropriate.
in lldb, stop on re-exec, guess gdb auto-continues after exec, why didn't notice in gdb. should able continue, , hit real breakpoint in bit.
might idea have setting control whether continue past exec or not. feel free file bug lldb.llvm.org bug reporter.
Comments
Post a Comment