[PATCH] Debugging LLVM IR with LLDB (and gdb)

Malea, Daniel daniel.malea at intel.com
Mon Apr 15 09:27:13 PDT 2013


Also,

If Clang folks want to use the debug IR pass, here's a simple patch that
enables it by default. That is, with this applied, invoke clang as such:

$ clang blah.cpp -g -o blah
$ gdb ./blah

And you will see IR in your debugger. If this turns out to be a useful
feature, maybe I should add it as an option say "-gllvm" or something
along those lines?


Thanks,
Dan


On 2013-04-15 12:19 PM, "Malea, Daniel" <daniel.malea at intel.com> wrote:

>Ah, sorry, I figured phabricator link was sufficient. Here are the 4
>patches that represent the latest phabricator review:
>
>
>
>Part #1: FormattedStream -- Add line tracking
>- previously formatted_raw_ostream tracked columns, now it tracks lines
>too
>- used by DebugIR pass to know the line number to connect to each IR
>instruction
>
>Part #2: Pull up AssemblyWriter interface into header to allow subclassing
>- made all functions virtual so that subclasses can specialize them
>- add printInstructionLine so that subclasses can choose whether or not to
>print the newline character (without having to implement printBasicBlock()
>- no intended change in functionality/behaviour!
>
>Part #3: DebugIR -- emit IR file and replace source lines with IR lines
>in MD
>- requires existing debug information to be present
>- fixes up file name and line number information
>- emits a "<orig_filename>-debug.ll" succinct IR file (without !dbg
>metadata
>or debug intrinsics) that can be read by a debugger
>
>Part #4: DebugIR tests -- lit tests for the line number transform
>- simple one-function case
>- function-calling case
>- external function calling case
>- exception throwing case
>- vector case
>- O3 (vector) case
>
>
>
>
>From: Chandler Carruth <chandlerc at google.com<mailto:chandlerc at google.com>>
>Date: Monday, 15 April, 2013 4:29 AM
>To: Stefanus Du Toit
><stefanus.du.toit at intel.com<mailto:stefanus.du.toit at intel.com>>
>Cc: Nadav Rotem <nrotem at apple.com<mailto:nrotem at apple.com>>, Daniel Malea
><daniel.malea at intel.com<mailto:daniel.malea at intel.com>>,
>"llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>"
><llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>>
>Subject: Re: [PATCH] Debugging LLVM IR with LLDB (and gdb)
>
>On Mon, Apr 15, 2013 at 1:21 AM, Du Toit, Stefanus
><stefanus.du.toit at intel.com<mailto:stefanus.du.toit at intel.com>> wrote:
>The link to the patch is at the bottom of the email.
>
>As usual, please attach the patch to the email. The best way when using
>Phabricator (as we documented) is to add the commits list to the review
>there so that everyone on the mailing list can follow the code review and
>participate even if not using the specific tool.
>
>
>--
>Stefanus Du Toit 
><stefanus.du.toit at intel.com<mailto:stefanus.du.toit at intel.com>>
>Intel Waterloo
>Phone: 519-591-1738<tel:519-591-1738>
>
>
>From: Nadav Rotem 
><nrotem at apple.com<mailto:nrotem at apple.com><mailto:nrotem at apple.com<mailto:
>nrotem at apple.com>>>
>Date: Sunday, 14 April, 2013 4:00 AM
>To: Daniel Malea 
><daniel.malea at intel.com<mailto:daniel.malea at intel.com><mailto:daniel.malea
>@intel.com<mailto:daniel.malea at intel.com>>>
>Cc: 
>"llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu><mailto:llvm-com
>mits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>>"
><llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu><mailto:llvm-com
>mits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>>>
>Subject: Re: [PATCH] Debugging LLVM IR with LLDB (and gdb)
>
>Hi Daniel,
>
>You forgot to attache the patch.
>
>Thanks,
>Nadav
>
>On Apr 11, 2013, at 1:53 PM, "Malea, Daniel"
><daniel.malea at intel.com<mailto:daniel.malea at intel.com><mailto:daniel.malea
>@intel.com<mailto:daniel.malea at intel.com>>> wrote:
>
>[Š]
>I'd be appreciative of testing and/or review comments! The patch is
>available on phabricator http://llvm-reviews.chandlerc.com/D659and the
>details from the review request follow.
>
>
>_______________________________________________
>llvm-commits mailing list
>llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>
>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 05_enable_by_default_in_clang.patch
Type: application/octet-stream
Size: 501 bytes
Desc: 05_enable_by_default_in_clang.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130415/76b3f9b1/attachment.obj>


More information about the llvm-commits mailing list