From d23bb945bd86c6533c78846f095337d776e2bc4a Mon Sep 17 00:00:00 2001 From: sagitario Date: Thu, 11 Jun 2009 09:01:00 +0000 Subject: v0.8: - tweaked visualizer macros to detect uninitialized associative arrays and to limit expansion to arrays with less than 1024 entries - renamed "data" pointer member of dynamic arrays to "ptr" --- CHANGES | 7 ++ README | 2 +- VERSION | 2 +- autoexp.snippet | 212 ++++++++++++++++++++++++++++++-------------------------- src/cv2pdb.cpp | 2 +- test/cvtest.d | 8 ++- 6 files changed, 132 insertions(+), 101 deletions(-) diff --git a/CHANGES b/CHANGES index 1452220..f687c0a 100644 --- a/CHANGES +++ b/CHANGES @@ -50,3 +50,10 @@ Version history 2009-06-08 Version 0.7 * corrected number of field entries in classes or struct, because DMD miscounts private members + +2009-06-11 Version 0.8 + + * tweaked visualizer macros to detect uninitialized associative arrays and to limit expansion + to arrays with less than 1024 entries + * renamed data pointer member of dynamic arrays to "ptr" to be consistent with the array property + in D. diff --git a/README b/README index 5311130..96934c7 100644 --- a/README +++ b/README @@ -19,7 +19,7 @@ Features * generates generic debug info for dynamic arrays, associative arrays and delegates * autoexp.dat allows convenient display of dynamic and associative arrays in watch windows * demangles function names for convenient display of callstack -* support for DMC CodeView information +* also works for the Digital Mars C/C++ compiler DMC License information ------------------- diff --git a/VERSION b/VERSION index a741d6c..d5d64b1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -VERSION = 0.7 +VERSION = 0.8 diff --git a/autoexp.snippet b/autoexp.snippet index 45dd5c8..0165311 100644 --- a/autoexp.snippet +++ b/autoexp.snippet @@ -36,123 +36,141 @@ dstring_viewhelper=$ADDIN(dviewhelper.dll,_DDStringView@28) ; string, wstring and dstring use __viewhelper string|wstring|dstring { - preview ( - #if ($e.data == 0) ( "null" ) - #else ( - #( - "[", $e.length, "] ", [$e.__viewhelper] - ) - ) - ) - stringview ( - #if ($e.data == 0) ( "null" ) - #else ( - #( - [$e.data, s] - ) - ) - ) - children ( - #( - length: [$e.length, i], - data: [$e.data] - ) - ) + + preview ( + #if ($e.ptr == 0) ( "null" ) + #else ( + #( "[", $e.length, "] ", [$e.__viewhelper] ) + ) + ) + stringview ( + #if ($e.ptr == 0) ( "null" ) + #else ( + #( [$e.ptr, s] ) + ) + ) + children ( + #( + length: [$e.length, i], + data: [$e.ptr] + ) + ) } ; strings as dynamic arrays of char (no __viewhelper, check -D option for cv2pdb!) const char[]|char[]|const wchar[]|wchar[]|const dchar[]|dchar[] { - preview ( - #if ($e.data == 0) ( "null" ) - #else ( - #( - "[", $e.length, "] ", [$e.data] - ) - ) - ) - stringview ( - #if ($e.data == 0) ( "null" ) - #else ( - #( - [$e.data, s] - ) - ) - ) - children ( - #( - length: [$e.length, i], - data: [$e.data] - ) - ) + + preview ( + #if ($e.ptr == 0) ( "null" ) + #else ( + #( "[", $e.length, "] ", [$e.ptr] ) + ) + ) + stringview ( + #if ($e.ptr == 0) ( "null" ) + #else ( + #( [$e.ptr, s] ) + ) + ) + children ( + #( + length: [$e.length, i], + data: [$e.ptr] + ) + ) } ; dynamic array *[] { - preview ( - #if ($e.data == 0) ( "null" ) - #else ( - #( - "[", $e.length, "](", - #array - ( - expr : ($e.data)[$i], - size : $e.length - ), - ")" - ) - ) - ) - children ( - #( - length: [$e.length, i], - #array ( - expr: $e.data[$i], - size: $e.length - ) - ) - ) + preview ( + #if ($e.ptr == 0) ( "null" ) + #else ( + #( + "[", $e.length, "](", + #array ( + expr : ($e.ptr)[$i], + size : $e.length + ), + ")" + ) + ) + ) + children ( + #( + length: [$e.length, i], + #array ( + expr: $e.ptr[$i], + size: $e.length + ) + ) + ) } ;; display associative array ;; +;; the "magic" sizes of the basic dynamic array are used to check for uninitialized +;; arrays +;; 97UL, 389UL, +;; 1_543UL, 6_151UL, +;; 24_593UL, 98_317UL, +;; 393_241UL, 1_572_869UL, +;; 6_291_469UL, 25_165_843UL, +;; 100_663_319UL, 402_653_189UL, +;; 1_610_612_741UL, 4_294_967_291UL, aa<*> { - preview( - #( - "[", $e.a->nodes, "] ", [(void*) $e.a] - ) - ) - children( - #( - #array ( - expr: &$e.a->b.data[$i], - size: $e.a->b.length - ) : - #tree ( - head : $e, - left : left, - right : right, - ; size : $c.size - ) : $e - ) - ) + preview( + #if($e.a == 0 || $e.a->b.ptr == 0) ( "null" ) + ; expressions must be in a sinlge line (sigh) + #elif($e.a->b.length == 97 || $e.a->b.length == 389 || $e.a->b.length == 1543 || $e.a->b.length == 6151 || $e.a->b.length == 24593 || $e.a->b.length == 98317 || $e.a->b.length == 393241 || $e.a->b.length == 1572869 || $e.a->b.length == 6291469 || $e.a->b.length == 25165843) + ( + #if($e.a->nodes > 1024) ( + #( "[", $e.a->nodes, "] ", [(void*) $e.a], " too large for expansion" ) + ) + #else ( + #( "[", $e.a->nodes, "] ", [(void*) $e.a] ) + ) + ) + #elif (1) ; no #else in a series of #elif !? + ( + #( "[", $e.a->nodes, "] ", [(void*) $e.a], " uninitialized" ) + ) + ) + children( + #if($e.a == 0 || $e.a->b.ptr == 0 || $e.a->nodes > 1024) + ( #array( expr: 0, size: 0 ) ) + #else ( + #( + #array ( + expr: &$e.a->b.ptr[$i], + size: $e.a->b.length + ) : + #tree ( + head : $e, + left : left, + right : right, + ) : $e + ) + ) + ) } ; display tree internal@aaA<*,*> { - preview( - #( "<", $e.key, ", ", $e.value, ">" ) - ) + preview( + #( "<", $e.key, ", ", $e.value, ">" ) + ) } -;; display null references for class objects +; display null references for class objects *@* { - preview( - #( - #if (&$e == 0) ( "null" ) - #else ( #( "[", [$e.__viewhelper], "] ", [$e,!] ) ) - ;; #else ( #( [$e,!] ) ) - ) - ) + preview( + #( + #if (&$e == 0) ( "null" ) + #else ( + #( "[", [$e.__viewhelper], "] ", [$e,!] ) + ) + ) + ) } ;; eo section Visualizer for D variables ;;;;;;;;;;;;;;;;;;;;;; diff --git a/src/cv2pdb.cpp b/src/cv2pdb.cpp index 4a3cba8..48d42b9 100644 --- a/src/cv2pdb.cpp +++ b/src/cv2pdb.cpp @@ -1214,7 +1214,7 @@ const char* CV2PDB::appendDynamicArray(int indexType, int elemType) // member elemType* data[] dfieldtype = (codeview_fieldtype*)(rdtype->fieldlist.list + len1); - int len2 = addFieldMember(dfieldtype, 1, 4, dataptrType, "data"); + int len2 = addFieldMember(dfieldtype, 1, 4, dataptrType, "ptr"); int numElem = 2; rdtype->fieldlist.len = len1 + len2 + 2; diff --git a/test/cvtest.d b/test/cvtest.d index 5c9c0dd..2336fc8 100644 --- a/test/cvtest.d +++ b/test/cvtest.d @@ -168,8 +168,14 @@ int main2(char[][]argv) alias_int_array int_array; int[] int_oem_long_dynarray; int_oem_long_dynarray ~= 12; - int[int] local_oem_int_assoc_array; local_oem_int_assoc_array[7] = 17; + int[int] local_oem_int_assoc_array; + for (int i = 0; i < 1024; i++) + local_oem_int_assoc_array[i] = 2*i; + + local_oem_int_assoc_array[5000] = 1; + + int *intptr = int_oem_long_dynarray.ptr; Object null_obj; derived_class null_derived; -- cgit v0.12