[macruby-changes] [3354] MacRuby/trunk/vm.cpp

source_changes at macosforge.org source_changes at macosforge.org
Tue Jan 26 16:29:44 PST 2010


Revision: 3354
          http://trac.macosforge.org/projects/ruby/changeset/3354
Author:   lsansonetti at apple.com
Date:     2010-01-26 16:29:42 -0800 (Tue, 26 Jan 2010)
Log Message:
-----------
backtrace fixes: assume line numbering and provide the full path of files

Modified Paths:
--------------
    MacRuby/trunk/vm.cpp

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2010-01-27 00:14:31 UTC (rev 3353)
+++ MacRuby/trunk/vm.cpp	2010-01-27 00:29:42 UTC (rev 3354)
@@ -75,7 +75,7 @@
 	std::vector<unsigned char *> ehs;
 
 	// Information retrieved from JITListener.
-	std::string file;
+	std::string path;
 	class Line {
 	    public:
 		uintptr_t address;
@@ -240,25 +240,31 @@
 	{
 	    RoxorFunction *function = current_function();
 
-	    std::string file;
+	    std::string path;
 	    for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) {
 		DebugLocTuple dlt = Details.MF->getDebugLocTuple(iter->Loc);
-		if (file.size() == 0) {
+		if (path.size() == 0) {
 #if LLVM_TOT
 		    DICompileUnit unit(dlt.Scope);
-		    file.append(unit.getFilename());
+		    path.append(unit.getDirectory());
+		    path.append("/");
+		    path.append(unit.getFilename());
 #else
 		    DICompileUnit unit(dlt.CompileUnit);
+		    std::string dir, file;
+		    unit.getDirectory(dir);
 		    unit.getFilename(file);
+		    path.append(dir);
+		    path.append("/");
+		    path.append(file);
 #endif
-		    assert(file.size() != 0);
 		}
 
 		RoxorFunction::Line line(iter->Address, dlt.Line);
 		function->lines.push_back(line);
 	    }
 
-	    function->file = file;
+	    function->path = path;
 	}
 };
 
@@ -585,16 +591,16 @@
 	    if (f != NULL) {
 		for (std::vector<RoxorFunction::Line>::iterator iter =
 			f->lines.begin(); iter != f->lines.end(); ++iter) {
-		    if ((*iter).address == (uintptr_t)addr) {
-			*ln = (*iter).line;
+		    *ln = (*iter).line;
+		    if ((*iter).address <= (uintptr_t)addr) {
 			break;
 		    }
 		}
 	    }
 	}
 	if (path != NULL) {
-	    if (f != NULL && f->file.size() > 0) {
-		strncpy(path, f->file.c_str(), path_len);
+	    if (f != NULL && f->path.size() > 0) {
+		strncpy(path, f->path.c_str(), path_len);
 	    }
 	    else {
 		strncpy(path, "core", path_len);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100126/edb5c0f8/attachment.html>


More information about the macruby-changes mailing list