[lldb-dev] sharing code between lldb and AddressSanitizer

Greg Clayton gclayton at apple.com
Wed Nov 30 17:35:40 PST 2011


On Nov 30, 2011, at 3:04 PM, Kostya Serebryany wrote:

> 
> 
> On Wed, Nov 30, 2011 at 2:56 PM, Greg Clayton <gclayton at apple.com> wrote:
> Yes, LLDB can do this.
> 
> When you are symbolicating, are you symbolicating using an address from a live process,
> 
> This is how I want it to work. And I want it to happen inside that process. 
>  
> or just using the virtual addresses in an object file itself?
> 
> This is how it works now. 
> asan prints a line like 
>    /home/kcc/llvm/build/a.out+0x402661

So if 0x402661 is an address that is already in terms of the virtual addresses in the a.out file itself, you can use example code from main.cpp mentioned below.

You could compile the main.cpp into "loopup" and run the result:

lookup /home/kcc/llvm/build/a.out 0x402661

And it should do the lookup you want. Let me know if you have any questions about how and what the example code in main.cpp is doing.

Greg

> and then addr2line/atos does symbolization offline. 
> 
> --kcc 
>  
> 
> If you are symbolicating using an address from the file, we already have a little C++ example for you:
> 
> https://llvm.org/svn/llvm-project/lldb/trunk/examples/lookup/main.cpp
> 
> If you want to load a bunch of files from a process at the addresses they were at when a backtrace or sample was taken, let me know. The example would change a little bit, but not too much.
> 
> Greg Clayton
> 
> 
> On Nov 29, 2011, at 5:56 PM, Kostya Serebryany wrote:
> 
> > Hello,
> >
> > I am working on integrating AddressSanitizer (aka asan, http://clang.llvm.org/docs/AddressSanitizer.html) run-time library with the llvm compiler-rt.
> > Asan needs to symbolize PCs, i.e. given a value of a PC it needs to produce the file name and the line number (if debug info is present).
> > Currently, this is achieved by printing the PCs as /path/to/object/file+offset and filtering the output with a script which uses addr2line/atos.
> > Ideally, symbolization should happen inside the process and should not require post processing.
> >
> > I would expect that lldb already has such functionality, right?
> > Somewhere in include/lldb/Symbol/Symtab.h?
> > Does it work on both Linux and Mac?
> > Do you think that it is possible/desirable to have this kind of code sharing between lldb and asan?
> > Will that work with the current build system (where lldb and compiler-rt/lib/asan are separate subprojects)?
> >
> > Thanks,
> >
> > --kcc
> > _______________________________________________
> > 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