Unfortunately, the current gdb support doesn't include line numbers. It'll tell you what function it crashed in and the stack trace though. Line numbers will probably come when the llvm-mc project is merged into the JIT. On Tue, Feb 9, 2010 at 9:37 AM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote:> Are you running this in a JIT? If so this will help: http://llvm.org/docs/DebuggingJITedCode.html. > > Garrison > > On Feb 9, 2010, at 10:33, Sebastian Schlunke wrote: > >> Hello, >> >> is there any way to debug a program in LLVM-IR line-by-line (i.e. with gdb)? >> >> The problem is, i have a program in human-readable-intermediate representation that segfaults, when executed. I want to know, which line in the IR causes this. >> >> Any help is appreciated. >> >> Best regards, >> Sebastian >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
I suspected something like that. :( I was hoping i could run the program and step throught IR-Code line by line, maybe even have a look at the variables. Well, what about compiling it into assembler-code. Is there any way to know which IR-line generated which assembler line(s)? (I do not need any optimizations or whatever, if that helps...) Sebastian On Tuesday 09 February 2010 18:45:56 you wrote:> Unfortunately, the current gdb support doesn't include line numbers. > It'll tell you what function it crashed in and the stack trace though. > > Line numbers will probably come when the llvm-mc project is merged into the JIT. > > On Tue, Feb 9, 2010 at 9:37 AM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote: > > Are you running this in a JIT? If so this will help: http://llvm.org/docs/DebuggingJITedCode.html. > > > > Garrison > > > > On Feb 9, 2010, at 10:33, Sebastian Schlunke wrote: > > > >> Hello, > >> > >> is there any way to debug a program in LLVM-IR line-by-line (i.e. with gdb)? > >> > >> The problem is, i have a program in human-readable-intermediate representation that segfaults, when executed. I want to know, which line in the IR causes this. > >> > >> Any help is appreciated. > >> > >> Best regards, > >> Sebastian > >> _______________________________________________ > >> LLVM Developers mailing list > >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > >
Sebastian Schlunke <schlunki at cs.tu-berlin.de> writes:> I suspected something like that. :( > > I was hoping i could run the program and step throught IR-Code line by line, maybe even have a look at the variables. > > Well, what about compiling it into assembler-code. Is there any way > to know which IR-line generated which assembler line(s)? (I do not > need any optimizations or whatever, if that helps...)What if you write a program that 1) adds a new GlobalVariable 2) prepends each instruction in the program with a volatile store to that GlobalVariable using a unique value (line number or instruction count). When the program crashes you can use gdb to read the contents of that GlobalVariable to see the last IR instruction that was executed? ;-)
Have you tried using 'lli' with --force-interpreter? Then you can step through the interpreter line by line, which is sort of liking stepping through the IR line by very-slow-line. :) - Daniel On Tue, Feb 9, 2010 at 10:49 AM, Sebastian Schlunke <schlunki at cs.tu-berlin.de> wrote:> I suspected something like that. :( > > I was hoping i could run the program and step throught IR-Code line by line, maybe even have a look at the variables. > > Well, what about compiling it into assembler-code. Is there any way to know which IR-line generated which assembler line(s)? (I do not need any optimizations or whatever, if that helps...) > > Sebastian > > On Tuesday 09 February 2010 18:45:56 you wrote: >> Unfortunately, the current gdb support doesn't include line numbers. >> It'll tell you what function it crashed in and the stack trace though. >> >> Line numbers will probably come when the llvm-mc project is merged into the JIT. >> >> On Tue, Feb 9, 2010 at 9:37 AM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote: >> > Are you running this in a JIT? If so this will help: http://llvm.org/docs/DebuggingJITedCode.html. >> > >> > Garrison >> > >> > On Feb 9, 2010, at 10:33, Sebastian Schlunke wrote: >> > >> >> Hello, >> >> >> >> is there any way to debug a program in LLVM-IR line-by-line (i.e. with gdb)? >> >> >> >> The problem is, i have a program in human-readable-intermediate representation that segfaults, when executed. I want to know, which line in the IR causes this. >> >> >> >> Any help is appreciated. >> >> >> >> Best regards, >> >> Sebastian >> >> _______________________________________________ >> >> LLVM Developers mailing list >> >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >> > >> > _______________________________________________ >> > LLVM Developers mailing list >> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >> >> > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >