Succeed with latest clang. Thank you very much! 在 2014年7月17日星期四UTC+8上午5时05分06秒,Alexey Samsonov写道: > > Hi, > > This looks like > https://code.google.com/p/address-sanitizer/issues/detail?id=235. > Recently (but, I guess, after llvm-3.4.1) there were improvements in debug > information for local variables in ASan builds. Can you try tip-of-trunk > Clang on that example? > > > On Tue, Jul 15, 2014 at 6:41 PM, Shiny Teng <[email protected] > <javascript:>> wrote: > >> Hi experts, >> I'm using llvm3.4.1 on OSX 10.9.3. >> My codes, >> >> // longstack.cc >> int* a; >> void foo(int n) >> { >> a[n]++; >> foo(++n); >> } >> int main(int argc, char** argv) { >> a = new int[30]; >> foo(0); >> } >> >> Build: >> /usr/local/Cellar/llvm34/3.4.1_1/bin/clang++-3.4 -O0 -g >> -fsanitize=address longstack.cc -o ./longstack >> >> Debug: >> (lldb) target create ~/Test\ Projects/clang/longstack >> Current executable set to '~/Test Projects/clang/longstack' (x86_64). >> (lldb) run --stop-at-entry >> Process 65604 launched: '/Users/tengxiang/Test Projects/clang/longstack' >> (x86_64) >> Process 65604 stopped >> * thread #1: tid = 0xa5879, 0x00007fff5fc01028 dyld`_dyld_start, stop >> reason = exec >> frame #0: 0x00007fff5fc01028 dyld`_dyld_start >> dyld`_dyld_start: >> -> 0x7fff5fc01028: popq %rdi >> 0x7fff5fc01029: pushq $0 >> 0x7fff5fc0102b: movq %rsp, %rbp >> 0x7fff5fc0102e: andq $-16, %rsp >> (lldb) b foo >> Breakpoint 1: where = longstack`foo(int) + 291 at longstack.cc:5, address >> = 0x0000000100000ab3 >> (lldb) c >> Process 65604 resuming >> Process 65604 stopped >> * thread #1: tid = 0xa5879, 0x0000000100000ab3 >> longstack`foo(n=<unavailable>) + 291 at longstack.cc:5, queue = >> 'com.apple.main-thread, stop reason = breakpoint 1.1 >> frame #0: 0x0000000100000ab3 longstack`foo(n=<unavailable>) + 291 at >> longstack.cc:5 >> 2 >> 3 void foo(int n) >> 4 { >> -> 5 a[n]++; >> 6 foo(++n); >> 7 } >> 8 >> (lldb) p n >> error: Couldn't materialize struct: size of variable n disagrees with the >> ValueObject's size >> Errored out in Execute, couldn't PrepareToExecuteJITExpression >> >> See I can't print variable's value. And bt won't show parameters' value, >> looks like >> frame #0: 0x0000000100000ab3 longstack`foo(n=<unavailable>) + 291 at >> longstack.cc:5 >> >> And then I tried remove -fsanitize=address, like >> /usr/local/Cellar/llvm34/3.4.1_1/bin/clang++-3.4 -O0 -g longstack.cc -o >> ./longstack >> >> It prints in lldb, >> (lldb) p n >> (int) $0 = 258504 >> >> Did I miss anything? Or is there a way to print variables in asan-ified >> executables in debugging? >> >> Regards, >> -xiang >> >> -- >> You received this message because you are subscribed to the Google Groups >> "address-sanitizer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Alexey Samsonov, Mountain View, CA >
-- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
