• R/O
  • SSH
  • HTTPS

eirdebug: Commit


Commit MetaInfo

Revision6 (tree)
Zeit2018-12-11 05:13:44
Autorquiret

Log Message

- small fix, needs bigger overhaul later.

Ändern Zusammenfassung

Diff

--- dbgtrace.cpp (revision 5)
+++ dbgtrace.cpp (revision 6)
@@ -26,6 +26,36 @@
2626 #include <sdk/MemoryUtils.h>
2727 #include <CFileSystem.common.stl.h>
2828
29+// TODO: think about getting this to use Eir types.
30+#include <sstream>
31+
32+AINLINE std::string to_string_hex( size_t num )
33+{
34+ std::stringstream stream;
35+
36+ stream << std::hex << num;
37+
38+ return stream.str();
39+}
40+
41+struct CRTHeapAllocator
42+{
43+ static AINLINE void* Allocate( void *refPtr, size_t memSize, size_t alignment )
44+ {
45+ return malloc( memSize );
46+ }
47+
48+ static AINLINE bool Resize( void *refPtr, void *memPtr, size_t newSize )
49+ {
50+ return false;
51+ }
52+
53+ static AINLINE void Free( void *refPtr, void *memPtr )
54+ {
55+ free( memPtr );
56+ }
57+};
58+
2959 // Specialized memory array.
3060 template <typename dataType>
3161 struct dbgtraceIterativeGrowableArrayManager
@@ -47,7 +77,7 @@
4777 {
4878 this->heapHandle = right.heapHandle;
4979
50- right.heapHandle = NULL;
80+ right.heapHandle = nullptr;
5181 }
5282
5383 inline ~dbgtracePrivateHeapAllocator( void )
@@ -535,7 +565,7 @@
535565 if ( symbolName.size() == 0 )
536566 {
537567 outputBuffer += "[0x";
538- outputBuffer += NumberUtil::to_string_hex( (size_t)csInfo.codePtr );
568+ outputBuffer += to_string_hex( (size_t)csInfo.codePtr );
539569 outputBuffer += "]";
540570 }
541571 else
@@ -542,7 +572,7 @@
542572 {
543573 outputBuffer += symbolName;
544574 outputBuffer += " at 0x";
545- outputBuffer += NumberUtil::to_string_hex( (size_t)csInfo.codePtr );
575+ outputBuffer += to_string_hex( (size_t)csInfo.codePtr );
546576 }
547577 }
548578 outputBuffer += " (";
@@ -550,12 +580,16 @@
550580 std::string fileName = csInfo.GetFileName();
551581
552582 // Since the filename can be pretty long, it needs special attention.
553- filePath directoryPart;
583+ eir::MultiString <CRTHeapAllocator> directoryPart;
554584
555- std::string fileNameItem = FileSystem::GetFileNameItem( fileName.c_str(), true, &directoryPart, NULL );
585+ auto fileNameItem = FileSystem::GetFileNameItem <CRTHeapAllocator> ( fileName.c_str(), true, &directoryPart, nullptr );
556586
557587 // Trim the directory.
558- outputBuffer += GetTrimmedString( directoryPart.convert_ansi(), 20 ) + fileNameItem;
588+ auto ansiDirPart = directoryPart.convert_ansi();
589+ auto ansiFileNameItem = fileNameItem.convert_ansi();
590+
591+ outputBuffer += GetTrimmedString( ansiDirPart.GetConstString(), 20 );
592+ outputBuffer.append( ansiFileNameItem.GetConstString() );
559593 }
560594 outputBuffer += ":";
561595 outputBuffer += std::to_string( csInfo.GetLineNumber() );
Show on old repository browser