Skip to content
This repository
Browse code

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...
commit 9b5bce3603308c551893fc9ddb6e40d6b1c46e97 1 parent 3cabadf
Laurent Sansonetti authored

Showing 4 changed files with 20 additions and 10 deletions. Show diff stats Hide diff stats

  1. +13 0 compiler.cpp
  2. +2 0  compiler.h
  3. +2 4 interpreter.cpp
  4. +3 6 vm.cpp
13 compiler.cpp
@@ -832,6 +832,19 @@ RoxorCompiler::attach_current_line_metadata(Instruction *insn)
832 832 }
833 833 }
834 834
  835 +void
  836 +RoxorCompiler::generate_location_path(std::string &path, DILocation loc)
  837 +{
  838 + if (loc.getFilename() == "-e") {
  839 + path.append(loc.getFilename());
  840 + }
  841 + else {
  842 + path.append(loc.getDirectory());
  843 + path.append("/");
  844 + path.append(loc.getFilename());
  845 + }
  846 +}
  847 +
835 848 Value *
836 849 RoxorCompiler::recompile_dispatch_argv(std::vector<Value *> &params, int offset)
837 850 {
2  compiler.h
@@ -76,6 +76,8 @@ class RoxorCompiler {
76 76 bool is_dynamic_class(void) { return dynamic_class; }
77 77 void set_dynamic_class(bool flag) { dynamic_class = flag; }
78 78
  79 + void generate_location_path(std::string &path, DILocation loc);
  80 +
79 81 protected:
80 82 DIFactory *debug_info;
81 83 DICompileUnit debug_compile_unit;
6 interpreter.cpp
@@ -84,11 +84,9 @@ RoxorInterpreter::interpret_call(CallInst *call)
84 84
85 85 MDNode *node = call->getMetadata(RoxorCompiler::shared->dbg_mdkind);
86 86 if (node != NULL) {
87   - DILocation loc(node);
88 87 std::string path;
89   - path.append(loc.getDirectory());
90   - path.append("/");
91   - path.append(loc.getFilename());
  88 + DILocation loc(node);
  89 + RoxorCompiler::shared->generate_location_path(path, loc);
92 90
93 91 Frame frame;
94 92 frame.name = (const char *)sel;
9 vm.cpp
@@ -265,14 +265,11 @@ class RoxorJITManager : public JITMemoryManager, public JITEventListener {
265 265 std::string path;
266 266 for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) {
267 267 MDNode *scope = iter->Loc.getAsMDNode(F.getContext());
268   - DILocation dil = DILocation(scope);
  268 + DILocation loc = DILocation(scope);
269 269 if (path.size() == 0) {
270   - DIScope scope = dil.getScope();
271   - path.append(scope.getDirectory());
272   - path.append("/");
273   - path.append(scope.getFilename());
  270 + RoxorCompiler::shared->generate_location_path(path, loc);
274 271 }
275   - RoxorFunction::Line line(iter->Address, dil.getLineNumber());
  272 + RoxorFunction::Line line(iter->Address, loc.getLineNumber());
276 273 function->lines.push_back(line);
277 274 }
278 275

0 comments on commit 9b5bce3

Please sign in to comment.
Something went wrong with that request. Please try again.