Diff
Modified: MacRuby/trunk/compiler.cpp (4546 => 4547)
--- 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 (4546 => 4547)
--- 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 (4546 => 4547)
--- 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 (4546 => 4547)
--- 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);
}