[Haiku-commits] r31326 - haiku/trunk/src/apps/debugger/debug_info

bonefish at BerliOS bonefish at mail.berlios.de
Tue Jun 30 14:57:42 CEST 2009


Author: bonefish
Date: 2009-06-30 14:57:41 +0200 (Tue, 30 Jun 2009)
New Revision: 31326
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31326&view=rev

Modified:
   haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.cpp
   haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.h
   haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp
Log:
Retrieve the source file declaration locations for functions and attach them
to the DwarfFunctionDebugInfo objects. The functions do now appear organized
by source file in the function list view. Unfortunately the list view is too
small to look as clear as it should. Got to think of something else I'm afraid.


Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.cpp	2009-06-30 12:48:46 UTC (rev 31325)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.cpp	2009-06-30 12:57:41 UTC (rev 31326)
@@ -12,11 +12,14 @@
 
 DwarfFunctionDebugInfo::DwarfFunctionDebugInfo(
 	DwarfImageDebugInfo* imageDebugInfo, DIESubprogram* subprogramEntry,
-	TargetAddressRangeList* addressRanges, const BString& name)
+	TargetAddressRangeList* addressRanges, const BString& name,
+	const BString& sourceFile, const SourceLocation& sourceLocation)
 	:
 	fImageDebugInfo(imageDebugInfo),
 	fAddressRanges(addressRanges),
-	fName(name)
+	fName(name),
+	fSourceFile(sourceFile),
+	fSourceLocation(sourceLocation)
 {
 	fImageDebugInfo->AddReference();
 	fAddressRanges->AddReference();
@@ -68,19 +71,19 @@
 const char*
 DwarfFunctionDebugInfo::SourceFileName() const
 {
-	return NULL;
+	return fSourceFile.Length() > 0 ? fSourceFile.String() : NULL;
 }
 
 
 SourceLocation
 DwarfFunctionDebugInfo::SourceStartLocation() const
 {
-	return SourceLocation();
+	return fSourceLocation;
 }
 
 
 SourceLocation
 DwarfFunctionDebugInfo::SourceEndLocation() const
 {
-	return SourceLocation();
+	return fSourceLocation;
 }

Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.h
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.h	2009-06-30 12:48:46 UTC (rev 31325)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfFunctionDebugInfo.h	2009-06-30 12:57:41 UTC (rev 31326)
@@ -8,6 +8,7 @@
 #include <String.h>
 
 #include "FunctionDebugInfo.h"
+#include "SourceLocation.h"
 
 
 class DIESubprogram;
@@ -21,7 +22,9 @@
 									DwarfImageDebugInfo* imageDebugInfo,
 									DIESubprogram* subprogramEntry,
 									TargetAddressRangeList* addressRanges,
-									const BString& name);
+									const BString& name,
+									const BString& sourceFile,
+									const SourceLocation& sourceLocation);
 	virtual						~DwarfFunctionDebugInfo();
 
 	virtual	SpecificImageDebugInfo* GetSpecificImageDebugInfo() const;
@@ -37,7 +40,9 @@
 private:
 			DwarfImageDebugInfo* fImageDebugInfo;
 			TargetAddressRangeList* fAddressRanges;
-			const BString		fName;
+			BString				fName;
+			BString				fSourceFile;
+			SourceLocation		fSourceLocation;
 };
 
 

Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp	2009-06-30 12:48:46 UTC (rev 31325)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp	2009-06-30 12:57:41 UTC (rev 31326)
@@ -117,10 +117,29 @@
 				rangeListReference.SetTo(rangeList, true);
 			}
 
+			// get the source location
+			const char* directory = NULL;
+			const char* file = NULL;
+			uint32 line = 0;
+			uint32 column = 0;
+			DwarfUtils::GetDeclarationLocation(fFile, subprogramEntry,
+				directory, file, line, column);
+			BString fileName;
+			if (file != NULL) {
+				if (directory != NULL)
+					fileName << directory << '/' << file;
+				else
+					fileName << file;
+			}
+			// TODO: Avoid unnessecary string allocation! The source file name
+			// is the same for all contained functions, so they could share the
+			// string.
+
 			// create and add the functions
 			DwarfFunctionDebugInfo* function
 				= new(std::nothrow) DwarfFunctionDebugInfo(this,
-					subprogramEntry, rangeList, name);
+					subprogramEntry, rangeList, name, fileName,
+					SourceLocation(line, column));
 			if (function == NULL || !functions.AddItem(function)) {
 				delete function;
 				return B_NO_MEMORY;




More information about the Haiku-commits mailing list