aboutsummaryrefslogtreecommitdiff
path: root/lib/Debugger/RuntimeInfo.cpp
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2005-11-02 18:05:50 +0000
committerJohn Criswell <criswell@uiuc.edu>2005-11-02 18:05:50 +0000
commitcfa435f79bf39fead32263a8b71c9ae440b55214 (patch)
tree2f1ef0a4c3fb5549b8bbb014891f92866d46e042 /lib/Debugger/RuntimeInfo.cpp
Mark these as failing on sparc instead of sparcv9.
The configure script no longer tells us that we're configuring for SparcV9 specifically. 2004-06-17-UnorderedCompares may work on SparcV8, but it's experiental anyway. 2005-02-20-AggregateSAVEEXPR should fail on any Solaris machine, as Solaris doesn't provide complex number support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_16@24155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Debugger/RuntimeInfo.cpp')
-rw-r--r--lib/Debugger/RuntimeInfo.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/Debugger/RuntimeInfo.cpp b/lib/Debugger/RuntimeInfo.cpp
new file mode 100644
index 0000000000..5d45104b50
--- /dev/null
+++ b/lib/Debugger/RuntimeInfo.cpp
@@ -0,0 +1,69 @@
+//===-- RuntimeInfo.cpp - Compute and cache info about running program ----===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the RuntimeInfo and related classes, by querying and
+// cachine information from the running inferior process.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Debugger/InferiorProcess.h"
+#include "llvm/Debugger/ProgramInfo.h"
+#include "llvm/Debugger/RuntimeInfo.h"
+using namespace llvm;
+
+//===----------------------------------------------------------------------===//
+// StackFrame class implementation
+
+StackFrame::StackFrame(RuntimeInfo &ri, void *ParentFrameID)
+ : RI(ri), SourceInfo(0) {
+ FrameID = RI.getInferiorProcess().getPreviousFrame(ParentFrameID);
+ if (FrameID == 0) throw "Stack frame does not exist!";
+
+ // Compute lazily as needed.
+ FunctionDesc = 0;
+}
+
+const GlobalVariable *StackFrame::getFunctionDesc() {
+ if (FunctionDesc == 0)
+ FunctionDesc = RI.getInferiorProcess().getSubprogramDesc(FrameID);
+ return FunctionDesc;
+}
+
+/// getSourceLocation - Return the source location that this stack frame is
+/// sitting at.
+void StackFrame::getSourceLocation(unsigned &lineNo, unsigned &colNo,
+ const SourceFileInfo *&sourceInfo) {
+ if (SourceInfo == 0) {
+ const GlobalVariable *SourceDesc = 0;
+ RI.getInferiorProcess().getFrameLocation(FrameID, LineNo,ColNo, SourceDesc);
+ SourceInfo = &RI.getProgramInfo().getSourceFile(SourceDesc);
+ }
+
+ lineNo = LineNo;
+ colNo = ColNo;
+ sourceInfo = SourceInfo;
+}
+
+//===----------------------------------------------------------------------===//
+// RuntimeInfo class implementation
+
+/// materializeFrame - Create and process all frames up to and including the
+/// specified frame number. This throws an exception if the specified frame
+/// ID is nonexistant.
+void RuntimeInfo::materializeFrame(unsigned ID) {
+ assert(ID >= CallStack.size() && "no need to materialize this frame!");
+ void *CurFrame = 0;
+ if (!CallStack.empty())
+ CurFrame = CallStack.back().getFrameID();
+
+ while (CallStack.size() <= ID) {
+ CallStack.push_back(StackFrame(*this, CurFrame));
+ CurFrame = CallStack.back().getFrameID();
+ }
+}