Browse files

when calculating a backtrace path from a -e script, omit the current …

…directory

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4547 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent 3cabadf commit 9b5bce3603308c551893fc9ddb6e40d6b1c46e97 @lrz lrz committed Sep 28, 2010
Showing with 20 additions and 10 deletions.
  1. +13 −0 compiler.cpp
  2. +2 −0 compiler.h
  3. +2 −4 interpreter.cpp
  4. +3 −6 vm.cpp
View
13 compiler.cpp
@@ -832,6 +832,19 @@ RoxorCompiler::attach_current_line_metadata(Instruction *insn)
}
}
+void
+RoxorCompiler::generate_location_path(std::string &path, DILocation loc)
+{
+ if (loc.getFilename() == "-e") {
+ path.append(loc.getFilename());
+ }
+ else {
+ path.append(loc.getDirectory());
+ path.append("/");
+ path.append(loc.getFilename());
+ }
+}
+
Value *
RoxorCompiler::recompile_dispatch_argv(std::vector<Value *> &params, int offset)
{
View
2 compiler.h
@@ -76,6 +76,8 @@ class RoxorCompiler {
bool is_dynamic_class(void) { return dynamic_class; }
void set_dynamic_class(bool flag) { dynamic_class = flag; }
+ void generate_location_path(std::string &path, DILocation loc);
+
protected:
DIFactory *debug_info;
DICompileUnit debug_compile_unit;
View
6 interpreter.cpp
@@ -84,11 +84,9 @@ RoxorInterpreter::interpret_call(CallInst *call)
MDNode *node = call->getMetadata(RoxorCompiler::shared->dbg_mdkind);
if (node != NULL) {
- DILocation loc(node);
std::string path;
- path.append(loc.getDirectory());
- path.append("/");
- path.append(loc.getFilename());
+ DILocation loc(node);
+ RoxorCompiler::shared->generate_location_path(path, loc);
Frame frame;
frame.name = (const char *)sel;
View
9 vm.cpp
@@ -265,14 +265,11 @@ class RoxorJITManager : public JITMemoryManager, public JITEventListener {
std::string path;
for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) {
MDNode *scope = iter->Loc.getAsMDNode(F.getContext());
- DILocation dil = DILocation(scope);
+ DILocation loc = DILocation(scope);
if (path.size() == 0) {
- DIScope scope = dil.getScope();
- path.append(scope.getDirectory());
- path.append("/");
- path.append(scope.getFilename());
+ RoxorCompiler::shared->generate_location_path(path, loc);
}
- RoxorFunction::Line line(iter->Address, dil.getLineNumber());
+ RoxorFunction::Line line(iter->Address, loc.getLineNumber());
function->lines.push_back(line);
}

0 comments on commit 9b5bce3

Please sign in to comment.