summaryrefslogtreecommitdiffstats
path: root/autoexp.snippet
blob: 0165311d27090d324fdf24a4d6952006c4bb583c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This file is part cv2pdb, a 
;; converter of DMD CodeView debug information to PDB files
;;
;; written by Rainer Schuetze, placed into the Public Domain
;;
;;	 D types
;; 
;; add the content of this file to 
;; <Visual Studio Installation Path>\Common7\Package\Debugger\autoexp.dat
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; load helper dll dviewhelper.dll to display strings
;;
;; add the following 2 lines to the [AutoExpand] section
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; [AutoExpand] 

object_viewhelper=$ADDIN(dviewhelper.dll,_DObjectView@28)
string_viewhelper=$ADDIN(dviewhelper.dll,_DStringView@28)
wstring_viewhelper=$ADDIN(dviewhelper.dll,_DWStringView@28)
dstring_viewhelper=$ADDIN(dviewhelper.dll,_DDStringView@28)

;; eo section AutoExpand for D variables ;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;	 D types visualizer
;; 
;; add the remainder of this file to the [Visualizer] section
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; [Visualizer]

; string, wstring and dstring use __viewhelper
string|wstring|dstring {

	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.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.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(
		#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, ">" )
	)
}

; display null references for class objects
*@* {
	preview(
		#( 
			#if (&$e == 0) ( "null" )
			#else ( 
				#( "[", [$e.__viewhelper], "] ", [$e,!] ) 
			)
		)
	)
}

;; eo section Visualizer for D variables ;;;;;;;;;;;;;;;;;;;;;;