Displaying 20 results from an estimated 39 matches for "getdirectory".
2011 Apr 27
1
[LLVMdev] LLVM internal getDirectory() for LexicalBlock debug information returns filename?
...lock:
if (const Instruction *Inst = dyn_cast<Instruction>(&I)) {
const DebugLoc &Loc = Inst->getDebugLoc();
if (!Loc.isUnknown()) {
LLVMContext &Ctx = Inst->getParent()->getParent()->getContext();
DIScope Scope(Loc.getScope(Ctx));
StringRef Dir = Scope.getDirectory(); // Wrong: contains filename
iso. directory
....
}
}
Here, if Scope refers to a Subprogram, this works correctly. However,
if Scope is a LexicalBlock, getDirectory() returns the filename
(conv.c) iso. the directory. The associated .ll does have a reference
to the proper directory (/home1/...
2012 Oct 04
2
[LLVMdev] question
...t;
>> Here is the code. I am running on llvm 3.1 on Lion (Mac 10.7.4)
>>
>> string getFileDirectory(const Instruction &I){
>>
>> MDNode *MD = I.getMetadata("dbg");
>>
>> DICompileUnit compileUnit(MD);
>>
>> return compileUnit.getDirectory().str();
>>
>> }
>>
>>
>> George
>>
>> On Wed, Oct 3, 2012 at 12:40 PM, Eric Christopher <echristo at gmail.com>
>> wrote:
>>>
>>> Without knowing the code that you've written and the IR that you're
>>> running...
2012 Oct 05
1
[LLVMdev] question
...IFooBar constructors like reinterpret-casts, not
"go find the thing I actually want" functions. If you hand DICompileUnit() a node
that is not a compile-unit metadata node, it's not going to tell you that you goofed.
If you _did_ have a CU metadata node, then DICompileUnit's getDirectory() would
work just fine. But you don't.
--paulr
________________________________
From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] on behalf of George Baah [georgebaah at gmail.com]
Sent: Thursday, October 04, 2012 7:19 PM
To: Eric Christopher
Cc: LLVM Developers Mailing...
2012 Oct 05
0
[LLVMdev] question
Hmmm, but it has a getDirectory function.
-G
On Thu, Oct 4, 2012 at 3:50 PM, Eric Christopher <echristo at gmail.com> wrote:
> That's because instructions have a location associated with them, not
> a compile unit.
>
> -eric
>
> On Thu, Oct 4, 2012 at 12:46 PM, George Baah <georgebaah at gmail.co...
2012 Oct 04
2
[LLVMdev] question
Here is the code. I am running on llvm 3.1 on Lion (Mac 10.7.4)
*string getFileDirectory*(*const* Instruction &I){
MDNode *MD = I.getMetadata("dbg");
DICompileUnit compileUnit(MD);
return compileUnit.getDirectory().str();
}
George
On Wed, Oct 3, 2012 at 12:40 PM, Eric Christopher <echristo at gmail.com>wrote:
> Without knowing the code that you've written and the IR that you're
> running on I'm
> not sure what I can do to help you.
>
> -eric
>
> On Wed, Oct 3, 2012...
2012 Oct 04
0
[LLVMdev] question
...eorgebaah at gmail.com> wrote:
> Here is the code. I am running on llvm 3.1 on Lion (Mac 10.7.4)
>
> *string getFileDirectory*(*const* Instruction &I){
>
> MDNode *MD = I.getMetadata("dbg");
>
> DICompileUnit compileUnit(MD);
>
> return compileUnit.getDirectory().str();
>
> }
>
> George
>
> On Wed, Oct 3, 2012 at 12:40 PM, Eric Christopher <echristo at gmail.com>wrote:
>
>> Without knowing the code that you've written and the IR that you're
>> running on I'm
>> not sure what I can do to help you.
&g...
2012 Oct 03
2
[LLVMdev] question
...n unit in llvm?
> > I am using DICompileUnit but for some reason I am getting blanks
> > for the directory name. Here is my code ...
> >
> > MDNode *MD = I.getMetadata("dbg");
> >
> > DICompileUnit compileUnit(MD);
> >
> > return compileUnit.getDirectory().str();
> >
>
> In general for these questions it's easier to look at how it's done in
> DwarfDebug.cpp and DwarfCompileUnit.cpp.
>
> -eric
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev...
2015 Aug 06
2
[LLVMdev] DebugInfo from LLVM Instruction
...LVM Instruction in the following way:
if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction
DILocation Loc(N); // DILocation is in DebugInfo.h
unsigned Line = Loc.getLineNumber();
StringRef File = Loc.getFilename();
StringRef Dir = Loc.getDirectory();
}
As specified also at http://llvm.org/docs/SourceLevelDebugging.html <http://llvm.org/docs/SourceLevelDebugging.html>
However, looks like that the instruction " DILocation Loc(N);” is not valid anymore,
Since the DILocation class is changed.
Is that right?
How can I extract debug...
2010 Jul 07
2
[LLVMdev] source line number for instruction
...bugging.html#ccxx_frontend:
if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction
DILocation Loc(N); // DILocation is in DebugInfo.h
unsigned Line = Loc.getLineNumber();
StringRef File = Loc.getFilename();
StringRef Dir = Loc.getDirectory();
}
Does this also work for release 2.7? I did not see the same thing at the
documentation for release 2.7.
Thanks,
Guoliang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100707/944903db/attachment.ht...
2012 Oct 02
2
[LLVMdev] question
Hi Guys,
How does one get the directory of the compilation unit in llvm?
I am using DICompileUnit but for some reason I am getting blanks
for the directory name. Here is my code ...
MDNode *MD = I.getMetadata("dbg");
DICompileUnit compileUnit(MD);
*return* compileUnit.getDirectory().str();
Thanks
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121002/fbb4351c/attachment.html>
2012 Oct 03
0
[LLVMdev] question
...am using DICompileUnit but for some reason I am getting blanks
>> > for the directory name. Here is my code ...
>> >
>> > MDNode *MD = I.getMetadata("dbg");
>> >
>> > DICompileUnit compileUnit(MD);
>> >
>> > return compileUnit.getDirectory().str();
>> >
>>
>> In general for these questions it's easier to look at how it's done in
>> DwarfDebug.cpp and DwarfCompileUnit.cpp.
>>
>> -eric
>
>
2012 Feb 28
0
[LLVMdev] Getting corresponding c-instruction line number along with ir-instruction in a function's CFG
...DILocation Loc(N); // inserted unsigned Line = Loc.getLineNumber(); // by Out<<"LN@"<<Line; // me StringRef File = Loc.getFilename(); // to Out<<"FN@"<<File; // get StringRef Dir = Loc.getDirectory(); // the Out<<"DN@"<<Dir; // mapping } //
// Print out name if it exists........Code compiles well but i get following linking problem :(llvm[2]: Linking Debug+Asserts executable llvm-as/home/rangi/llvm/build/Debug+Asserts/lib/libLLVMCore.a(AsmWriter.o):...
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...ta and MDDbgKind)
>
> llvm::MetadataContext *TheMetadata = M->getContext().getMetadata();
> MDDbgKind = TheMetadata->getMDKind("dbg");
> if (MDDbgKind) {
> if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) {
> DILocation Loc(Dbg);
> ...
> Loc.getDirectory()
> Loc.getFilename()
> Loc.getLineNumber()
> Loc.getColumnNumber()
> ....
> }
>
A grep through my LLVM 2.7 source tree does not find MetadataContext
anywhere. Is this something that was added to LLVM mainline after the
LLVM 2.7 branch was created?
I'm usi...
2011 Dec 19
2
[LLVMdev] DwarfDebug craziness
...ppet weirds me out and breaks Rust debug information
generation. Specifically, when creating a new compile unit, we see
this:
>CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
> DICompileUnit DIUnit(N);
> StringRef FN = DIUnit.getFilename();
> CompilationDir = DIUnit.getDirectory();
> unsigned ID = GetOrCreateSourceID(FN, CompilationDir);
Note how CompilationDir is passed to GetOrCreateSourceID as DirName?
That means that the map of compilation units is created entirely based
on file names excluding the path, so two compilation units that happen
to share a name generat...
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
Dear LLVMers,
I'm updating some code to use the new LLVM 2.7 API. One piece of this
code uses the findStopPoint() function to find the source filename and
line number information of an instruction.
What is the best way to do this under LLVM 2.7 now that the stop point
intrinsic has been removed? It appears that the debug information is
attached as metadata, but what is the easiest way
2010 Mar 16
0
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...this (you can of course cache TheMetadata and MDDbgKind)
llvm::MetadataContext *TheMetadata = M->getContext().getMetadata();
MDDbgKind = TheMetadata->getMDKind("dbg");
if (MDDbgKind) {
if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) {
DILocation Loc(Dbg);
...
Loc.getDirectory()
Loc.getFilename()
Loc.getLineNumber()
Loc.getColumnNumber()
....
}
}
Best regards,
--Edwin
2010 Mar 16
0
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...vm::MetadataContext *TheMetadata = M->getContext().getMetadata();
>> MDDbgKind = TheMetadata->getMDKind("dbg");
>> if (MDDbgKind) {
>> if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) {
>> DILocation Loc(Dbg);
>> ...
>> Loc.getDirectory()
>> Loc.getFilename()
>> Loc.getLineNumber()
>> Loc.getColumnNumber()
>> ....
>> }
>>
>
> A grep through my LLVM 2.7 source tree does not find MetadataContext
> anywhere. Is this something that was added to LLVM mainline after...
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...Metadata = M->getContext().getMetadata();
>>> MDDbgKind = TheMetadata->getMDKind("dbg");
>>> if (MDDbgKind) {
>>> if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) {
>>> DILocation Loc(Dbg);
>>> ...
>>> Loc.getDirectory()
>>> Loc.getFilename()
>>> Loc.getLineNumber()
>>> Loc.getColumnNumber()
>>> ....
>>> }
>>>
>>>
>> A grep through my LLVM 2.7 source tree does not find MetadataContext
>> anywhere. Is this s...
2010 Jul 07
0
[LLVMdev] source line number for instruction
...if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM
> instruction
> DILocation Loc(N); // DILocation is in
> DebugInfo.h
> unsigned Line = Loc.getLineNumber();
> StringRef File = Loc.getFilename();
> StringRef Dir = Loc.getDirectory();
> }
> Does this also work for release 2.7?
Yes.
> I did not see the same thing at the documentation for release 2.7.
The link you cited is the documentation for release 2.7.
Trevor
2012 Oct 02
0
[LLVMdev] question
...one get the directory of the compilation unit in llvm?
> I am using DICompileUnit but for some reason I am getting blanks
> for the directory name. Here is my code ...
>
> MDNode *MD = I.getMetadata("dbg");
>
> DICompileUnit compileUnit(MD);
>
> return compileUnit.getDirectory().str();
>
In general for these questions it's easier to look at how it's done in
DwarfDebug.cpp and DwarfCompileUnit.cpp.
-eric