Revision: 4547 http://trac.macosforge.org/projects/ruby/changeset/4547 Author: lsansonetti@apple.com Date: 2010-09-27 23:04:36 -0700 (Mon, 27 Sep 2010) Log Message: ----------- when calculating a backtrace path from a -e script, omit the current directory Modified Paths: -------------- MacRuby/trunk/compiler.cpp MacRuby/trunk/compiler.h MacRuby/trunk/interpreter.cpp MacRuby/trunk/vm.cpp Modified: MacRuby/trunk/compiler.cpp =================================================================== --- MacRuby/trunk/compiler.cpp 2010-09-28 05:47:47 UTC (rev 4546) +++ MacRuby/trunk/compiler.cpp 2010-09-28 06:04:36 UTC (rev 4547) @@ -832,6 +832,19 @@ } } +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 *> ¶ms, int offset) { Modified: MacRuby/trunk/compiler.h =================================================================== --- MacRuby/trunk/compiler.h 2010-09-28 05:47:47 UTC (rev 4546) +++ MacRuby/trunk/compiler.h 2010-09-28 06:04:36 UTC (rev 4547) @@ -76,6 +76,8 @@ 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; Modified: MacRuby/trunk/interpreter.cpp =================================================================== --- MacRuby/trunk/interpreter.cpp 2010-09-28 05:47:47 UTC (rev 4546) +++ MacRuby/trunk/interpreter.cpp 2010-09-28 06:04:36 UTC (rev 4547) @@ -84,11 +84,9 @@ 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; Modified: MacRuby/trunk/vm.cpp =================================================================== --- MacRuby/trunk/vm.cpp 2010-09-28 05:47:47 UTC (rev 4546) +++ MacRuby/trunk/vm.cpp 2010-09-28 06:04:36 UTC (rev 4547) @@ -265,14 +265,11 @@ 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); }
participants (1)
-
source_changes@macosforge.org