[LLVMdev] Load from abs address generated bad code on LLVM 2.4

Andrew Haley aph at redhat.com
Fri Jan 23 04:43:51 PST 2009


Chris Lattner wrote:
> On Jan 21, 2009, at 4:15 AM, Andrew Haley wrote:
>>> That should work fine, just use "jit" instead of "x86-emitter" as the
>>> debug type.
>> That's impossible: CurrentDebugType is now private; it appears
>> nowhere in the installed headers.  I can't find any public interface
>> to allow a JIT to set it.
> 
> Ah ok.  I'd suggest doing what llvm-gcc does here, it is a much more  
> stable API:
> 
>    std::vector<const char*> Args;
>    Args.push_back(""); // program name
>    Args.push_back("-debug-only=jit");
>    ...
>    Args.push_back(0);  // Null terminator.
>    cl::ParseCommandLineOptions(Args.size()-1, (char**)&Args[0]);
> 
> This also gives you control over optimizations and codegen options,

Sadly, that doesn't work either.  Well, it works once, but then you
can't change it back.  We need something more like

--- ./lib/Support/Debug.cpp~    2009-01-23 12:15:27.000000000 +0000
+++ lib/Support/Debug.cpp       2009-01-23 12:15:53.000000000 +0000
@@ -48,7 +48,7 @@
   static cl::opt<DebugOnlyOpt, true, cl::parser<std::string> >
   DebugOnly("debug-only", cl::desc("Enable a specific type of debug output"),
             cl::Hidden, cl::value_desc("debug string"),
-            cl::location(DebugOnlyOptLoc), cl::ValueRequired);
+            cl::location(DebugOnlyOptLoc), cl::ValueRequired, cl::ZeroOrMore);
 #endif
 }


to allow it to be dynamically used by a JIT.  Of course, with a large program
being JITted it's really important to be able just to use debugging exactly
where you need it.

Andrew.



More information about the llvm-dev mailing list