[LLVMdev] Writing my own debugger... use __builtin_frame_address or is there something better?

RICHARD STUCKEY richard.stuckey at virgin.net
Mon Jan 5 04:16:31 PST 2015


"So I thought "it won't be too hard to make my own debugger"...  "

>From someone who has spent most of his career writing debuggers:  "Errrr,
no".

I am currently working on adding debug information generation to the front
end of an LLVM-based compiler, and that has taken over a year of full-time
work so far (*) - and that's just to generate the information for use by an
existing debugger based on gdb.  If you are planning on developing a new
debugger from scratch, be prepared to devote several years of your life to
it.

(*) though in large part that's because I've had to implement all aspects
of functions in the generated IR, as the LLVM DIBuilder API does not
support inlined functions, and the front end inlines all calls.

On 5 January 2015 at 11:16, David Chisnall <David.Chisnall at cl.cam.ac.uk>
wrote:

> On 4 Jan 2015, at 17:39, John Smith <xp0bpe at gmail.com> wrote:
> >
> > I was hoping there might be an LLVM compiler switch to say "allocate
> these variables in a linear straightforward fashion"...
>
> Doing this will significantly impact the performance of the register
> allocator and various mid-level optimisations.  If you are willing to take
> this hit, you can do it relatively easily by generating a single C
> structure containing all of your local variables.  You can also follow the
> approach taken in the 'garbage collection in uncooperative environments'
> paper and create a linked list of these structures that can be walked by
> your debugger as well as by the garbage collector (if you need one).
>
> Your best bet, however, is to ditch the idea of generating C and generate
> LLVM IR, with the relevant debug info, directly.  This will also allow you
> to use all of the existing infrastructure in lldb for debugging, simply
> requiring you to write language-specific parts.
>
> David
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150105/73ce0666/attachment.html>


More information about the llvm-dev mailing list