Advice on debugging?

I've been using lli to do most of my unit tests for the compiler that I'm writing. However, when I get a test that crashes, its difficult to find which instruction it was that caused the crash. I tried running bugpoint, but it didn't seem to work for me, and upon reading the documentation, it seems to be intended for a different purpose than finding bugs in my source program; It seems to be related more to finding errors in the various optimizer passes.

So for example, when I run lli on my program:

Ping? Still looking for advice in figuring out how and why my generated code is causing lli to crash...

Talin wrote:

There is simply not enough information here to make an educated guess. But I'd say this is most likely not an optimization issue. Can you run lli in gdb to see where it is failing? Also you can add command line option -debug-only=jit. That should tell you which function is tripping lli up.

Evan

Ping? Still looking for advice in figuring out how and why my generated
code is causing lli to crash...

Did you run your code through the verifier?

> So for example, when I run lli on my program:
> ----------------------------------------------------------
> Assertion failed: (V == V2 && "Didn't find key?"), function RemoveKey,
> file StringMap.cpp, line 177.

This looks like either an lli bug, or invalid bitcode (see my remark on
the verifier above). If it passes the verifier, please reduce a testcase
and open a bug report. How were you running lli by the way - interpreter
or jit?

> But when I run bugpoint, I get:

...

> bugpoint can't help you with your problem!
> ----------------------------------------------------------
>
> To be honest, I am not sure what this all means.

It means that the problem is lli specific. Try running bugpoint with
-run-int or -run-jit (depending on whether you were using the JIT or
the interpreter version of lli).

Ciao,

Duncan.

Duncan Sands wrote:

Ping? Still looking for advice in figuring out how and why my generated code is causing lli to crash...
    
Did you run your code through the verifier?
  

Yes I did. And llvm-dis has no problem printing out the disassembled code.

So for example, when I run lli on my program:
----------------------------------------------------------
Assertion failed: (V == V2 && "Didn't find key?"), function RemoveKey, file StringMap.cpp, line 177.
      
This looks like either an lli bug, or invalid bitcode (see my remark on
the verifier above). If it passes the verifier, please reduce a testcase
and open a bug report. How were you running lli by the way - interpreter
or jit?
  

I get the same result with -force-interpreter and without.

I'll file a bug as suggested.