[PATCH] DebugIR with no existing debug information

Malea, Daniel daniel.malea at intel.com
Mon Jun 24 13:56:36 PDT 2013


Thanks for your comments Ben! Please see the updated patches.

To clarify, the pass won't modify an existing IR file on disk when it's
created with default parameters; instead, it will just use the path of the
on-disk file whenn generating the new debug metadata so the debugger will
just open the existing file. I updated the comments to make that more
explicit and also added tests for that behaviour.

To implement the unit tests, I refactored two things:
1. Separated some IRBuilder code in the MCJIT unit tests so these could
reuse it
2. Moved DebugIR declaration to a separate (private) header so tests can
access a more advanced interface

The lit tests remain unchanged, so I'm not attaching those.

Thanks,
Dan

On 2013-06-24 9:29 AM, "Langmuir, Ben" <ben.langmuir at intel.com> wrote:

>Sending again, since the llvm-commits address was incorrect.  Sorry for
>the duplicate email.
>
>Hi Dan,
>
>Overall looks good to me.
>
>
>> diff --git a/include/llvm/Transforms/Instrumentation.h
>> b/include/llvm/Transforms/Instrumentation.h
>> +/// Any existing debug metadata is mostly preserved in order to allow
>> +accessing /// variables in the original source.
>
>Tests?
>
>
>+/// createDebugIRPass - Enable interactive stepping through LLVM IR in
>LLDB
>+///                     (or GDB). When creating a DebugIR pass with this
>+///                     function, no source file is output to disk. If
>the IR
>+///                     file to be debugged is not on disk, use the
>version of
>+///                     this function with parameters in order to
>generate the
>+///                     file that will be seen by the debugger.
>+ModulePass *createDebugIRPass();
>
>So I would use this function if my IR file is already on disk, and this
>implies that the IR file is modified in-place.  Whereas, if I was running
>this pass from Clang, I would want to use the version with parameters,
>right?  If so we should be explicit about the fact on-disk IR files will
>be modified in-place.
>
>
>> diff --git a/lib/Transforms/Instrumentation/DebugIR.cpp
>> b/lib/Transforms/Instrumentation/DebugIR.cpp
>> +// FIXME: instead of replacing debug metadata, this pass should allow
>> +for // additional metadata should be used to point capable debuggers
>> +to the IR file // without destroying the mapping to the original
>>source file.
>
>In the second line, s/should/to/
>
>
>> #include <string>
>>  
>> +#include <unistd.h>
>> +
>>  #include "llvm/ADT/OwningPtr.h"
>
>LLVM coding standards prefer system headers after llvm/.. headers.
>
>Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_ir_implementation_v2.patch
Type: application/octet-stream
Size: 32747 bytes
Desc: debug_ir_implementation_v2.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130624/8eb94f20/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_ir_unittests.patch
Type: application/octet-stream
Size: 14345 bytes
Desc: debug_ir_unittests.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130624/8eb94f20/attachment-0001.obj>


More information about the llvm-commits mailing list