1 | #include "../BasicCompiler_Common/common.h"
|
---|
2 |
|
---|
3 | //デバッグ用
|
---|
4 | #include "../BasicCompiler_Common/debug.h"
|
---|
5 |
|
---|
6 | //変数リストのツリーハンドル
|
---|
7 | HWND hVarTree_Global,hVarTree_Local,hVarTree_This;
|
---|
8 |
|
---|
9 | int VarList_Array(HWND hVarTree,HTREEITEM hParent,DWORD offset,int type,int *SubScripts,LONG_PTR lpIndex);
|
---|
10 | void VarList_Member(HWND hVarTree,HTREEITEM hParent,DWORD pTopOffset,CClass *pobj_c,BOOL bPtr);
|
---|
11 | void VarList_Insert(HWND hVarTree,TV_INSERTSTRUCT *lptv,char *VarName,int type,DWORD offset,LONG_PTR lpIndex){
|
---|
12 | extern HANDLE hDebugProcess;
|
---|
13 | int i2;
|
---|
14 | char temporary[255],temp2[255];
|
---|
15 | DWORD dwData,dwAccessByte;
|
---|
16 | double dbl;
|
---|
17 | float flt;
|
---|
18 | WORD wData;
|
---|
19 | BYTE byteData;
|
---|
20 | HTREEITEM hParent;
|
---|
21 |
|
---|
22 | if(type==DEF_OBJECT||type==DEF_STRUCT){
|
---|
23 | if( type==DEF_OBJECT ){
|
---|
24 | // 参照型ということを考慮する
|
---|
25 | ReadProcessMemory(hDebugProcess,(void *)offset,&dwData,sizeof(void *),&dwAccessByte);
|
---|
26 | offset = dwData;
|
---|
27 | }
|
---|
28 |
|
---|
29 | sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_OBJECT,offset);
|
---|
30 | lptv->item.iImage=1;
|
---|
31 | lptv->item.iSelectedImage=1;
|
---|
32 | hParent=TreeView_InsertItem(hVarTree,lptv);
|
---|
33 |
|
---|
34 | VarList_Member(hVarTree,hParent,offset,(CClass *)lpIndex,0);
|
---|
35 | return;
|
---|
36 | }
|
---|
37 | if(type==DEF_PTR_OBJECT||type==DEF_PTR_STRUCT){
|
---|
38 | i2=ReadProcessMemory(hDebugProcess,(void *)offset,&dwData,sizeof(DWORD),&dwAccessByte);
|
---|
39 |
|
---|
40 | sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_POINTEROFOBJECT,dwData);
|
---|
41 | lptv->item.iImage=4;
|
---|
42 | lptv->item.iSelectedImage=4;
|
---|
43 | hParent=TreeView_InsertItem(hVarTree,lptv);
|
---|
44 |
|
---|
45 | if(i2) VarList_Member(hVarTree,hParent,dwData,(CClass *)lpIndex,1);
|
---|
46 | return;
|
---|
47 | }
|
---|
48 | else{
|
---|
49 | if(type==DEF_PTR_CHAR||type==MAKE_PTR_TYPE(DEF_BYTE,1)){
|
---|
50 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&dwData,sizeof(DWORD),&dwAccessByte)){
|
---|
51 | for(i2=0;;i2++){
|
---|
52 | if(!ReadProcessMemory(hDebugProcess,(void *)(dwData+i2),&temporary[i2],1,&dwAccessByte)){
|
---|
53 | i2=-1;
|
---|
54 | break;
|
---|
55 | }
|
---|
56 | if(temporary[i2]=='\0') break;
|
---|
57 | if(i2==64){
|
---|
58 | lstrcpy(temporary+i2,"...");
|
---|
59 | break;
|
---|
60 | }
|
---|
61 | }
|
---|
62 | if(i2==-1) sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,dwData,dwData);
|
---|
63 | else sprintf(lptv->item.pszText,"%s %d(&H%X) \"%s\"",VarName,dwData,dwData,temporary);
|
---|
64 | }
|
---|
65 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
66 | }
|
---|
67 | else if(type==DEF_DOUBLE){
|
---|
68 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&dbl,sizeof(double),&dwAccessByte)){
|
---|
69 | sprintf(lptv->item.pszText,"%s %.15g",VarName,dbl);
|
---|
70 | }
|
---|
71 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
72 | }
|
---|
73 | else if(type==DEF_SINGLE){
|
---|
74 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&flt,sizeof(float),&dwAccessByte)){
|
---|
75 | sprintf(lptv->item.pszText,"%s %.6g",VarName,flt);
|
---|
76 | }
|
---|
77 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
78 | }
|
---|
79 | else if(type==DEF_INT64){
|
---|
80 | _int64 i64data;
|
---|
81 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&dwAccessByte)){
|
---|
82 | _i64toa(i64data,temporary,10);
|
---|
83 | _i64toa(i64data,temp2,16);
|
---|
84 | CharUpper(temp2);
|
---|
85 | sprintf(lptv->item.pszText,"%s %s(&H%s)",VarName,temporary,temp2);
|
---|
86 | }
|
---|
87 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
88 | }
|
---|
89 | else if(type==DEF_QWORD){
|
---|
90 | _int64 i64data;
|
---|
91 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&dwAccessByte)){
|
---|
92 | _ui64toa(i64data,temporary,10);
|
---|
93 | _ui64toa(i64data,temp2,16);
|
---|
94 | CharUpper(temp2);
|
---|
95 | sprintf(lptv->item.pszText,"%s %s(&H%s)",VarName,temporary,temp2);
|
---|
96 | }
|
---|
97 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
98 | }
|
---|
99 | else if(type==DEF_LONG){
|
---|
100 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&dwData,sizeof(DWORD),&dwAccessByte)){
|
---|
101 | sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,dwData,dwData);
|
---|
102 | }
|
---|
103 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
104 | }
|
---|
105 | else if(type==DEF_DWORD||IsPtrType(type)){
|
---|
106 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&dwData,sizeof(DWORD),&dwAccessByte)){
|
---|
107 | sprintf(lptv->item.pszText,"%s %u(&H%X)",VarName,dwData,dwData);
|
---|
108 | }
|
---|
109 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
110 | }
|
---|
111 | else if(type==DEF_INTEGER || (isUnicode&&type==DEF_CHAR)){
|
---|
112 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&wData,sizeof(WORD),&dwAccessByte)){
|
---|
113 | sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,(short)wData,(short)wData);
|
---|
114 | }
|
---|
115 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
116 | }
|
---|
117 | else if(type==DEF_WORD){
|
---|
118 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&wData,sizeof(WORD),&dwAccessByte)){
|
---|
119 | sprintf(lptv->item.pszText,"%s %u(&H%X)",VarName,wData,wData);
|
---|
120 | }
|
---|
121 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
122 | }
|
---|
123 | else if(type==DEF_SBYTE || (isUnicode==false&&type==DEF_CHAR)){
|
---|
124 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&byteData,sizeof(BYTE),&dwAccessByte)){
|
---|
125 | temporary[0]=byteData;
|
---|
126 | temporary[1]=0;
|
---|
127 | sprintf(lptv->item.pszText,"%s %d(&H%X)'%s'",VarName,(char)byteData,byteData,temporary);
|
---|
128 | }
|
---|
129 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
130 | }
|
---|
131 | else if(type==DEF_BYTE){
|
---|
132 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&byteData,sizeof(BYTE),&dwAccessByte)){
|
---|
133 | temporary[0]=byteData;
|
---|
134 | temporary[1]=0;
|
---|
135 | sprintf(lptv->item.pszText,"%s %d(&H%X)'%s'",VarName,byteData,byteData,temporary);
|
---|
136 | }
|
---|
137 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
138 | }
|
---|
139 | else if(type==DEF_BOOLEAN){
|
---|
140 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&byteData,sizeof(BYTE),&dwAccessByte)){
|
---|
141 | if( byteData ) lstrcpy( temporary, "True" );
|
---|
142 | else lstrcpy( temporary, "False" );
|
---|
143 | sprintf(lptv->item.pszText,"%s %s",VarName,temporary);
|
---|
144 | }
|
---|
145 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
146 | }
|
---|
147 | lptv->item.iImage=2;
|
---|
148 | lptv->item.iSelectedImage=2;
|
---|
149 | }
|
---|
150 | TreeView_InsertItem(hVarTree,lptv);
|
---|
151 | }
|
---|
152 | void VarList_Member(HWND hVarTree,HTREEITEM hParent,DWORD pTopOffset,CClass *pobj_c,BOOL bPtr){
|
---|
153 | int i,i2;
|
---|
154 | char VarData[VN_SIZE],VarName[VN_SIZE];
|
---|
155 | TV_INSERTSTRUCT tv;
|
---|
156 |
|
---|
157 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
158 | tv.hInsertAfter=TVI_LAST;
|
---|
159 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
160 | tv.hParent=hParent;
|
---|
161 | tv.item.pszText=VarData;
|
---|
162 |
|
---|
163 | for(i=0;i<pobj_c->iMemberNum;i++){
|
---|
164 | if(bPtr){
|
---|
165 | lstrcpy(VarName,"->");
|
---|
166 | lstrcat(VarName,pobj_c->ppobj_Member[i]->name);
|
---|
167 | }
|
---|
168 | else{
|
---|
169 | lstrcpy(VarName,".");
|
---|
170 | lstrcat(VarName,pobj_c->ppobj_Member[i]->name);
|
---|
171 | }
|
---|
172 |
|
---|
173 | LONG_PTR offset = pobj_c->GetMemberOffset( pobj_c->ppobj_Member[i]->name, &i2 );
|
---|
174 |
|
---|
175 | if(pobj_c->ppobj_Member[i]->SubScripts[0]!=-1){
|
---|
176 | //構造体内の配列
|
---|
177 | sprintf(VarData,"%s %s(&H%X)",VarName,STRING_ARRAY,pTopOffset+offset);
|
---|
178 | tv.item.iImage=0;
|
---|
179 | tv.item.iSelectedImage=0;
|
---|
180 | hParent=TreeView_InsertItem(hVarTree,&tv);
|
---|
181 |
|
---|
182 | VarList_Array(hVarTree,hParent,
|
---|
183 | pTopOffset+offset,
|
---|
184 | pobj_c->ppobj_Member[i]->TypeInfo.type,
|
---|
185 | pobj_c->ppobj_Member[i]->SubScripts,
|
---|
186 | pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
187 | }
|
---|
188 | else{
|
---|
189 | //メンバ変数
|
---|
190 | VarList_Insert(hVarTree,
|
---|
191 | &tv,
|
---|
192 | VarName,
|
---|
193 | pobj_c->ppobj_Member[i]->TypeInfo.type,
|
---|
194 | pTopOffset+offset,
|
---|
195 | pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
196 | }
|
---|
197 | }
|
---|
198 | }
|
---|
199 | int VarList_Array(HWND hVarTree,HTREEITEM hParent,DWORD offset,int type,int *SubScripts,LONG_PTR lpIndex){
|
---|
200 | int i,i2,i3,ElementNum,MemCounter,UseCount[255],TypeSize;
|
---|
201 | char temporary[VN_SIZE],temp2[DIGIT_SIZE];
|
---|
202 |
|
---|
203 | TV_INSERTSTRUCT tv;
|
---|
204 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
205 | tv.hInsertAfter=TVI_LAST;
|
---|
206 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
207 | tv.hParent=hParent;
|
---|
208 | tv.item.pszText=temporary;
|
---|
209 |
|
---|
210 | TypeSize=GetTypeSize(type,lpIndex);
|
---|
211 |
|
---|
212 | for(i=0;i<255;i++){
|
---|
213 | if(SubScripts[i]==-1) break;
|
---|
214 | UseCount[i]=0;
|
---|
215 | }
|
---|
216 | UseCount[i]=-2;
|
---|
217 | MemCounter=0;
|
---|
218 | while(1){
|
---|
219 | UseCount[i]++;
|
---|
220 | for(ElementNum=0;SubScripts[i-ElementNum]<UseCount[i-ElementNum];ElementNum++){
|
---|
221 | UseCount[i-ElementNum]=0;
|
---|
222 | if(i-ElementNum-1<0) return MemCounter;
|
---|
223 | UseCount[i-ElementNum-1]++;
|
---|
224 | }
|
---|
225 |
|
---|
226 | if(MemCounter<50){
|
---|
227 | temporary[0]='[';
|
---|
228 | temporary[1]=0;
|
---|
229 | for(i2=0;i2<i;i2++){
|
---|
230 | sprintf(temp2,"%d",UseCount[i2]);
|
---|
231 | lstrcat(temporary,temp2);
|
---|
232 | lstrcat(temporary,",");
|
---|
233 | }
|
---|
234 | i3=lstrlen(temporary);
|
---|
235 | temporary[i3-1]=']';
|
---|
236 | temporary[i3]=0;
|
---|
237 |
|
---|
238 | VarList_Insert(hVarTree,&tv,temporary,type,offset+MemCounter*TypeSize,lpIndex);
|
---|
239 | }
|
---|
240 |
|
---|
241 | MemCounter++;
|
---|
242 | if(MemCounter==50){
|
---|
243 | lstrcpy(tv.item.pszText,"...");
|
---|
244 | TreeView_InsertItem(hVarTree,&tv);
|
---|
245 | }
|
---|
246 | }
|
---|
247 | return 0;
|
---|
248 | }
|
---|
249 | void RefreshGlobalVar(void){
|
---|
250 | extern DWORD ImageBase;
|
---|
251 | int i;
|
---|
252 | char temporary[VN_SIZE];
|
---|
253 | TV_INSERTSTRUCT tv;
|
---|
254 | HTREEITEM hParent;
|
---|
255 |
|
---|
256 | TreeView_DeleteAllItems(hVarTree_Global);
|
---|
257 |
|
---|
258 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
259 | tv.hInsertAfter=TVI_LAST;
|
---|
260 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
261 | tv.hParent=TVI_ROOT;
|
---|
262 | tv.item.pszText=temporary;
|
---|
263 |
|
---|
264 | extern HANDLE hDebugProcess;
|
---|
265 | extern int MemPos_RWSection;
|
---|
266 | extern int MaxGlobalVarNum;
|
---|
267 | extern VARIABLE *GlobalVar;
|
---|
268 |
|
---|
269 | for(i=0;i<MaxGlobalVarNum;i++){
|
---|
270 | VARIABLE *pVar=&GlobalVar[i];
|
---|
271 |
|
---|
272 | //スコープ外の場合は無視
|
---|
273 | if(pVar->ScopeLevel!=0){
|
---|
274 | if(rva_to_real(pVar->ScopeStartAddress) <= pobj_dti->lplpObp[0] &&
|
---|
275 | pobj_dti->lplpObp[0] < rva_to_real(pVar->ScopeEndAddress)){
|
---|
276 | //範囲内
|
---|
277 | }
|
---|
278 | else{
|
---|
279 | //範囲外
|
---|
280 | continue;
|
---|
281 | }
|
---|
282 | }
|
---|
283 |
|
---|
284 | if(!pobj_nv->bShow_DefaultSystem_Var){
|
---|
285 | if(memcmp(pVar->name,"_System_",8)==0||
|
---|
286 | memcmp(pVar->name,"_DebugSys_",10)==0||
|
---|
287 | memcmp(pVar->name,"_PromptSys_",11)==0) continue;
|
---|
288 | }
|
---|
289 | if(!pobj_nv->bShow_Rad_Var){
|
---|
290 | if(memcmp(pVar->name,"_RadSys_",8)==0) continue;
|
---|
291 | }
|
---|
292 | if(!pobj_nv->bShow_GUID_Var){
|
---|
293 | if(memcmp(pVar->name,"GUID_",5)==0||
|
---|
294 | memcmp(pVar->name,"IID_",4)==0||
|
---|
295 | memcmp(pVar->name,"CLSID_",6)==0) continue;
|
---|
296 | }
|
---|
297 |
|
---|
298 | //静的メンバ
|
---|
299 | if(strstr(pVar->name,".")) continue;
|
---|
300 |
|
---|
301 | if(pVar->bArray){
|
---|
302 | sprintf(temporary,"%s %s(&H%X)",
|
---|
303 | pVar->name,
|
---|
304 | STRING_ARRAY,
|
---|
305 | ImageBase+MemPos_RWSection+pVar->offset);
|
---|
306 | tv.item.iImage=0;
|
---|
307 | tv.item.iSelectedImage=0;
|
---|
308 | hParent=TreeView_InsertItem(hVarTree_Global,&tv);
|
---|
309 |
|
---|
310 | VarList_Array(hVarTree_Global,hParent,
|
---|
311 | ImageBase+MemPos_RWSection+pVar->offset,
|
---|
312 | pVar->type,
|
---|
313 | pVar->SubScripts,
|
---|
314 | pVar->u.index);
|
---|
315 | }
|
---|
316 | else{
|
---|
317 | VarList_Insert(hVarTree_Global,
|
---|
318 | &tv,
|
---|
319 | pVar->name,
|
---|
320 | pVar->type,
|
---|
321 | ImageBase+MemPos_RWSection+pVar->offset,
|
---|
322 | pVar->u.index);
|
---|
323 | }
|
---|
324 | }
|
---|
325 | }
|
---|
326 | void RefreshLocalVar(void){
|
---|
327 | int i,i2,i3,sw;
|
---|
328 | char temporary[VN_SIZE];
|
---|
329 | TV_INSERTSTRUCT tv;
|
---|
330 | HTREEITEM hParent;
|
---|
331 | ULONG_PTR lpData;
|
---|
332 | LONG_PTR offset;
|
---|
333 | ULONG_PTR lpAccBytes;
|
---|
334 |
|
---|
335 | TreeView_DeleteAllItems(hVarTree_Local);
|
---|
336 |
|
---|
337 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
338 | tv.hInsertAfter=TVI_LAST;
|
---|
339 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
340 | tv.hParent=TVI_ROOT;
|
---|
341 | tv.item.pszText=temporary;
|
---|
342 |
|
---|
343 | extern HANDLE hDebugProcess;
|
---|
344 | extern HWND hDebugWnd;
|
---|
345 | i2=SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
346 | i2=pobj_dti->iProcLevel-i2;
|
---|
347 |
|
---|
348 | if(pobj_dti->lplpSpBase[i2]==0) return;
|
---|
349 |
|
---|
350 | extern SUBINFO **ppSubHash;
|
---|
351 | SUBINFO *psi;
|
---|
352 | for(i3=0,sw=0;i3<MAX_HASH;i3++){
|
---|
353 | psi=ppSubHash[i3];
|
---|
354 | while(psi){
|
---|
355 | if(rva_to_real(psi->CompileAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
356 | pobj_dti->lplpObp[i2] < rva_to_real(psi->EndOpAddr)){
|
---|
357 | sw=1;
|
---|
358 | break;
|
---|
359 | }
|
---|
360 |
|
---|
361 | psi=psi->pNextData;
|
---|
362 | }
|
---|
363 | if(sw) break;
|
---|
364 | }
|
---|
365 | if(!psi) return;
|
---|
366 |
|
---|
367 | for(i=0;i<psi->VarNum;i++){
|
---|
368 | VARIABLE *pVar=&psi->pVar[i];
|
---|
369 |
|
---|
370 | //スコープ外の場合は無視
|
---|
371 | if(pVar->ScopeLevel!=0){
|
---|
372 | if(rva_to_real(pVar->ScopeStartAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
373 | pobj_dti->lplpObp[i2] < rva_to_real(pVar->ScopeEndAddress)){
|
---|
374 | //範囲内
|
---|
375 | }
|
---|
376 | else{
|
---|
377 | //範囲外
|
---|
378 | continue;
|
---|
379 | }
|
---|
380 | }
|
---|
381 |
|
---|
382 | if(pVar->bArray){
|
---|
383 | sprintf(temporary,"%s %s(&H%X)",
|
---|
384 | pVar->name,
|
---|
385 | STRING_ARRAY,
|
---|
386 | pobj_dti->lplpSpBase[i2]+pVar->offset);
|
---|
387 | tv.item.iImage=0;
|
---|
388 | tv.item.iSelectedImage=0;
|
---|
389 | hParent=TreeView_InsertItem(hVarTree_Local,&tv);
|
---|
390 |
|
---|
391 | VarList_Array(hVarTree_Local,hParent,
|
---|
392 | pobj_dti->lplpSpBase[i2]+pVar->offset,
|
---|
393 | pVar->type,
|
---|
394 | pVar->SubScripts,
|
---|
395 | pVar->u.index);
|
---|
396 | }
|
---|
397 | else{
|
---|
398 | offset=pobj_dti->lplpSpBase[i2]+pVar->offset;
|
---|
399 | if(pVar->fRef){
|
---|
400 | ReadProcessMemory(hDebugProcess,(void *)offset,&lpData,sizeof(ULONG_PTR),&lpAccBytes);
|
---|
401 | offset=lpData;
|
---|
402 | }
|
---|
403 | VarList_Insert(hVarTree_Local,&tv,
|
---|
404 | pVar->name,
|
---|
405 | pVar->type,
|
---|
406 | offset,
|
---|
407 | pVar->u.index);
|
---|
408 | }
|
---|
409 | }
|
---|
410 |
|
---|
411 |
|
---|
412 |
|
---|
413 | /////////////////////////////
|
---|
414 | // Thisオブジェクトのリスト
|
---|
415 | /////////////////////////////
|
---|
416 |
|
---|
417 | TreeView_DeleteAllItems(hVarTree_This);
|
---|
418 | if(!psi->pobj_ParentClass) return;
|
---|
419 |
|
---|
420 | //Thisポインタを取得
|
---|
421 | LONG_PTR pThis;
|
---|
422 | for(i=0;i<psi->VarNum;i++){
|
---|
423 | if(lstrcmp(psi->pVar[i].name,"_System_LocalThis")==0) break;
|
---|
424 | }
|
---|
425 | if(i==psi->VarNum) return;
|
---|
426 | lpData=pobj_dti->lplpSpBase[i2]+psi->pVar[i].offset;
|
---|
427 | ReadProcessMemory(hDebugProcess,(void *)lpData,&pThis,sizeof(LONG_PTR),&lpAccBytes);
|
---|
428 |
|
---|
429 | for(i=0;i<psi->pobj_ParentClass->iMemberNum;i++){
|
---|
430 | offset = psi->pobj_ParentClass->GetMemberOffset( psi->pobj_ParentClass->ppobj_Member[i]->name, &i2 );
|
---|
431 |
|
---|
432 | if(psi->pobj_ParentClass->ppobj_Member[i]->SubScripts[0]!=-1){
|
---|
433 | //配列
|
---|
434 | sprintf(temporary,"%s %s(&H%X)",
|
---|
435 | psi->pobj_ParentClass->ppobj_Member[i]->name,
|
---|
436 | STRING_ARRAY,
|
---|
437 | offset);
|
---|
438 | tv.item.iImage=0;
|
---|
439 | tv.item.iSelectedImage=0;
|
---|
440 | hParent=TreeView_InsertItem(hVarTree_This,&tv);
|
---|
441 |
|
---|
442 | VarList_Array(hVarTree_This,hParent,
|
---|
443 | pThis+offset,
|
---|
444 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.type,
|
---|
445 | psi->pobj_ParentClass->ppobj_Member[i]->SubScripts,
|
---|
446 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
447 | }
|
---|
448 | else{
|
---|
449 | VarList_Insert(hVarTree_This,&tv,
|
---|
450 | psi->pobj_ParentClass->ppobj_Member[i]->name,
|
---|
451 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.type,
|
---|
452 | pThis+offset,
|
---|
453 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
454 | }
|
---|
455 | }
|
---|
456 | }
|
---|
457 | void RefreshGlobalVar_with_WindowLock(void){
|
---|
458 | extern HWND hDebugWnd;
|
---|
459 |
|
---|
460 | //処理時間を短くするため、一時的に非表示にする
|
---|
461 | LockWindowUpdate(hDebugWnd);
|
---|
462 | ShowWindow(GetParent(hVarTree_Global),SW_HIDE);
|
---|
463 |
|
---|
464 | //リフレッシュ
|
---|
465 | RefreshGlobalVar();
|
---|
466 |
|
---|
467 | LockWindowUpdate(NULL);
|
---|
468 | ShowWindow(GetParent(hVarTree_Global),SW_SHOW);
|
---|
469 | }
|
---|
470 | void RefreshLocalVar_with_WindowLock(void){
|
---|
471 | extern HWND hDebugWnd;
|
---|
472 |
|
---|
473 | //処理時間を短くするため、一時的に非表示にする
|
---|
474 | LockWindowUpdate(hDebugWnd);
|
---|
475 | ShowWindow(GetParent(hVarTree_Local),SW_HIDE);
|
---|
476 |
|
---|
477 | //リフレッシュ
|
---|
478 | RefreshLocalVar();
|
---|
479 |
|
---|
480 | LockWindowUpdate(NULL);
|
---|
481 | ShowWindow(GetParent(hVarTree_Local),SW_SHOW);
|
---|
482 | }
|
---|
483 |
|
---|
484 | void SetCalcToWatchList(HWND hListView,int iItem,char *buffer){
|
---|
485 | int i;
|
---|
486 | char temporary[255],temp2[255];
|
---|
487 |
|
---|
488 | //エスケープシーケンスをセット
|
---|
489 | SetEscapeSequenceFormat(buffer);
|
---|
490 |
|
---|
491 | //ブランクを除去
|
---|
492 | KillStringSpaces(buffer);
|
---|
493 |
|
---|
494 | //カッコを相互チェック
|
---|
495 | if(!CheckParenthesis2(buffer)){
|
---|
496 | ListView_SetItemText(hListView,iItem,1,"式の解析に失敗");
|
---|
497 | return;
|
---|
498 | }
|
---|
499 |
|
---|
500 | double dbl;
|
---|
501 | _int64 i64data;
|
---|
502 | i=StaticCalculation(true, buffer,0,&i64data,0,1);
|
---|
503 | if(IsRealNumberType(i)){
|
---|
504 | memcpy(&dbl,&i64data,sizeof(double));
|
---|
505 | }
|
---|
506 |
|
---|
507 | if(i==0){
|
---|
508 | ListView_SetItemText(hListView,iItem,1,"式の解析に失敗");
|
---|
509 | }
|
---|
510 | else if(i==-1){
|
---|
511 | ListView_SetItemText(hListView,iItem,1,STRING_CANNOTACCESS);
|
---|
512 | }
|
---|
513 | else{
|
---|
514 | if(IsRealNumberType(i))
|
---|
515 | sprintf(temporary,"%.15g (&H%08X)",dbl,(int)dbl);
|
---|
516 | else if(Is64Type(i)){
|
---|
517 | _i64toa(i64data,temporary,10);
|
---|
518 | _i64toa(i64data,temp2,16);
|
---|
519 | CharUpper(temp2);
|
---|
520 | sprintf(temporary+lstrlen(temporary)," (&H%s)",temp2);
|
---|
521 | }
|
---|
522 | else sprintf(temporary,"%d (&H%08X)",(long)i64data,(long)i64data);
|
---|
523 |
|
---|
524 | ListView_SetItemText(hListView,iItem,1,temporary);
|
---|
525 | }
|
---|
526 | }
|
---|
527 | void RefreshWatchList(void){
|
---|
528 | extern HWND hDebugWnd;
|
---|
529 | HWND hListView;
|
---|
530 | int i,i2;
|
---|
531 | char temporary[VN_SIZE];
|
---|
532 |
|
---|
533 | hListView=GetDlgItem(hDebugWnd,IDC_WATCHLIST);
|
---|
534 | i2=ListView_GetItemCount(hListView);
|
---|
535 | for(i=0;i<i2-1;i++){
|
---|
536 | ListView_GetItemText(hListView,i,0,temporary,VN_SIZE);
|
---|
537 |
|
---|
538 | //演算結果を表示
|
---|
539 | SetCalcToWatchList(hListView,i,temporary);
|
---|
540 | }
|
---|
541 | }
|
---|
542 |
|
---|
543 | BOOL SetDebugProcCombo(HWND hProcCombo){
|
---|
544 | int i2,i3;
|
---|
545 | char temporary[255];
|
---|
546 |
|
---|
547 | extern DWORD ImageBase;
|
---|
548 | extern int MemPos_CodeSection;
|
---|
549 |
|
---|
550 | //行番号情報
|
---|
551 | extern int MaxLineInfoNum;
|
---|
552 | extern LINEINFO *pLineInfo;
|
---|
553 | for(i3=0;i3<(int)pobj_dti->iProcLevel+1;i3++){
|
---|
554 | for(i2=0;i2<MaxLineInfoNum-1;i2++){
|
---|
555 | if((pLineInfo[i2].TopObp+ImageBase+MemPos_CodeSection)<=pobj_dti->lplpObp[i3]&&
|
---|
556 | pobj_dti->lplpObp[i3]<=(pLineInfo[i2+1].TopObp+ImageBase+MemPos_CodeSection)) break;
|
---|
557 | }
|
---|
558 | if(i2==MaxLineInfoNum) pobj_dti->lpdwCp[i3]=-1;
|
---|
559 | else{
|
---|
560 | pobj_dti->lpdwCp[i3]=pLineInfo[i2].TopCp;
|
---|
561 | }
|
---|
562 | }
|
---|
563 | for(i3=0;i3<(int)pobj_dti->iProcLevel+1;i3++){
|
---|
564 | if(pobj_dti->lpdwCp[i3]==-1){
|
---|
565 | pobj_dti->iProcLevel--;
|
---|
566 | for(i2=i3;i2<(int)pobj_dti->iProcLevel+1;i2++){
|
---|
567 | pobj_dti->lplpObp[i2]=pobj_dti->lplpObp[i2+1];
|
---|
568 | pobj_dti->lplpSpBase[i2]=pobj_dti->lplpSpBase[i2+1];
|
---|
569 | pobj_dti->lpdwCp[i2]=pobj_dti->lpdwCp[i2+1];
|
---|
570 | }
|
---|
571 | i3--;
|
---|
572 | continue;
|
---|
573 | }
|
---|
574 | }
|
---|
575 |
|
---|
576 | if(!GetLineNum(pobj_dti->lpdwCp[pobj_dti->iProcLevel],&i2,temporary)){
|
---|
577 | extern HWND hMainDlg;
|
---|
578 | //"デバッグ情報の取得に失敗"
|
---|
579 | MessageBox(hMainDlg,STRING_DEBUG_FAILED,"ActiveBasic error",MB_OK);
|
---|
580 | return 0;
|
---|
581 | }
|
---|
582 | ShowErrorLine(i2,temporary);
|
---|
583 |
|
---|
584 | //プロシージャ コンボボックス
|
---|
585 | extern SUBINFO **ppSubHash;
|
---|
586 | SUBINFO *psi;
|
---|
587 | int sw;
|
---|
588 | SendMessage(hProcCombo,CB_RESETCONTENT,0,0);
|
---|
589 | for(i2=pobj_dti->iProcLevel;i2>=0;i2--){
|
---|
590 | for(i3=0,sw=0;i3<MAX_HASH;i3++){
|
---|
591 | psi=ppSubHash[i3];
|
---|
592 | while(psi){
|
---|
593 | if(rva_to_real(psi->CompileAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
594 | pobj_dti->lplpObp[i2] < rva_to_real(psi->EndOpAddr)){
|
---|
595 | lstrcpy(temporary,psi->name);
|
---|
596 | sw=1;
|
---|
597 | break;
|
---|
598 | }
|
---|
599 | psi=psi->pNextData;
|
---|
600 | }
|
---|
601 | if(sw) break;
|
---|
602 | }
|
---|
603 | if(!psi){
|
---|
604 | if(i2==0){
|
---|
605 | lstrcpy(temporary,"Global");
|
---|
606 | pobj_dti->lplpSpBase[i2]=0;
|
---|
607 | }
|
---|
608 | else lstrcpy(temporary,"error");
|
---|
609 | }
|
---|
610 | SendMessage(hProcCombo,CB_ADDSTRING,0,(long)temporary);
|
---|
611 | }
|
---|
612 | SendMessage(hProcCombo,CB_SETCURSEL,0,0);
|
---|
613 |
|
---|
614 | return pobj_dti->iProcLevel;
|
---|
615 | }
|
---|
616 |
|
---|
617 | //IDC_THREADCOMBOプロシージャ
|
---|
618 | LRESULT CALLBACK ThreadComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
619 | extern WNDPROC OldThreadComboProc;
|
---|
620 | int i2;
|
---|
621 | DWORD dwThreadID;
|
---|
622 | char temporary[255];
|
---|
623 |
|
---|
624 | switch(message){
|
---|
625 | case WM_COMMAND:
|
---|
626 | if(HIWORD(wParam)==CBN_SELCHANGE){
|
---|
627 | SendMessage(hwnd,CB_GETLBTEXT,SendMessage(hwnd,CB_GETCURSEL,0,0),(long)temporary);
|
---|
628 | sscanf(temporary+2,"%X",&dwThreadID);
|
---|
629 |
|
---|
630 | i2=0;
|
---|
631 | while(_DebugSys_dwThreadID[i2]!=dwThreadID) i2++;
|
---|
632 |
|
---|
633 | //次回のステップ実行対象を指定
|
---|
634 | extern int NextStepThreadNum;
|
---|
635 | NextStepThreadNum=i2;
|
---|
636 |
|
---|
637 | //スレッド情報をリフレッシュ
|
---|
638 | pobj_dti->Reflesh(i2);
|
---|
639 |
|
---|
640 | SetDebugProcCombo(GetDlgItem(GetParent(hwnd),IDC_PROCCOMBO));
|
---|
641 |
|
---|
642 | SendDlgItemMessage(GetParent(hwnd),IDC_PROCCOMBO,WM_COMMAND,MAKELONG(0,CBN_SELCHANGE),0);
|
---|
643 | }
|
---|
644 | break;
|
---|
645 | }
|
---|
646 | return CallWindowProc(OldThreadComboProc,hwnd,message,wParam,lParam);
|
---|
647 | }
|
---|
648 | //IDC_PROCCOMBOプロシージャ
|
---|
649 | LRESULT CALLBACK ProcComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
650 | extern WNDPROC OldProcComboProc;
|
---|
651 | int i2,i3;
|
---|
652 | char temporary[MAX_PATH];
|
---|
653 |
|
---|
654 | switch(message){
|
---|
655 | case WM_COMMAND:
|
---|
656 | if(HIWORD(wParam)==CBN_SELCHANGE){
|
---|
657 | i2=SendMessage(hwnd,CB_GETCURSEL,0,0);
|
---|
658 | GetLineNum(pobj_dti->lpdwCp[pobj_dti->iProcLevel-i2],&i3,temporary);
|
---|
659 | ShowErrorLine(i3,temporary);
|
---|
660 |
|
---|
661 | RefreshLocalVar_with_WindowLock();
|
---|
662 | }
|
---|
663 | break;
|
---|
664 | }
|
---|
665 | return CallWindowProc(OldProcComboProc,hwnd,message,wParam,lParam);
|
---|
666 | }
|
---|
667 | void InitVarList(DWORD dwThreadId){
|
---|
668 | extern HWND hDebugWnd;
|
---|
669 | int i2,i3,i5;
|
---|
670 | char temporary[255];
|
---|
671 |
|
---|
672 |
|
---|
673 | //スレッド
|
---|
674 | SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_RESETCONTENT,0,0);
|
---|
675 | extern DWORD _DebugSys_dwThreadID[256];
|
---|
676 | for(i2=0;i2<256;i2++){
|
---|
677 | if(_DebugSys_dwThreadID[i2]){
|
---|
678 | sprintf(temporary,"&H%08X",_DebugSys_dwThreadID[i2]);
|
---|
679 | SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_ADDSTRING,0,(LPARAM)temporary);
|
---|
680 | if(_DebugSys_dwThreadID[i2]==dwThreadId){
|
---|
681 | extern int NextStepThreadNum;
|
---|
682 | NextStepThreadNum=i2;
|
---|
683 | }
|
---|
684 | }
|
---|
685 | }
|
---|
686 | sprintf(temporary,"&H%08X",dwThreadId);
|
---|
687 | i5=(int)SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_FINDSTRING,0,(LPARAM)temporary);
|
---|
688 | SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_SETCURSEL,i5,0);
|
---|
689 |
|
---|
690 | i2=SetDebugProcCombo(GetDlgItem(hDebugWnd,IDC_PROCCOMBO));
|
---|
691 |
|
---|
692 |
|
---|
693 | ///////////////////////////////////////////////
|
---|
694 | // 実行中のプロシージャのローカル変数をセット
|
---|
695 | ///////////////////////////////////////////////
|
---|
696 |
|
---|
697 | extern VARIABLE *LocalVar;
|
---|
698 | extern int MaxLocalVarNum;
|
---|
699 | int sw;
|
---|
700 |
|
---|
701 | MaxLocalVarNum=0;
|
---|
702 | pobj_CompilingClass=0;
|
---|
703 |
|
---|
704 | i2=SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
705 | i2=pobj_dti->iProcLevel-i2;
|
---|
706 |
|
---|
707 | if(pobj_dti->lplpSpBase[i2]){
|
---|
708 | extern SUBINFO **ppSubHash;
|
---|
709 | SUBINFO *psi;
|
---|
710 | for(i3=0,sw=0;i3<MAX_HASH;i3++){
|
---|
711 | psi=ppSubHash[i3];
|
---|
712 | while(psi){
|
---|
713 | if(rva_to_real(psi->CompileAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
714 | pobj_dti->lplpObp[i2] < rva_to_real(psi->EndOpAddr)){
|
---|
715 | sw=1;
|
---|
716 | break;
|
---|
717 | }
|
---|
718 |
|
---|
719 | psi=psi->pNextData;
|
---|
720 | }
|
---|
721 | if(sw) break;
|
---|
722 | }
|
---|
723 |
|
---|
724 |
|
---|
725 | if(psi){
|
---|
726 | LocalVar=psi->pVar;
|
---|
727 | MaxLocalVarNum=psi->VarNum;
|
---|
728 |
|
---|
729 | pobj_CompilingClass=psi->pobj_ParentClass;
|
---|
730 | }
|
---|
731 | }
|
---|
732 |
|
---|
733 |
|
---|
734 | ////////////////////////
|
---|
735 | // 変数リストを再表示
|
---|
736 | ////////////////////////
|
---|
737 |
|
---|
738 | //処理時間を短くするため、一時的に非表示にする
|
---|
739 | LockWindowUpdate(hDebugWnd);
|
---|
740 | ShowWindow(GetParent(hVarTree_Global),SW_HIDE);
|
---|
741 | ShowWindow(GetDlgItem(hDebugWnd,IDC_WATCHLIST),SW_HIDE);
|
---|
742 |
|
---|
743 | //リフレッシュ
|
---|
744 | RefreshLocalVar();
|
---|
745 | RefreshGlobalVar();
|
---|
746 | RefreshWatchList();
|
---|
747 |
|
---|
748 | LockWindowUpdate(NULL);
|
---|
749 | ShowWindow(GetParent(hVarTree_Global),SW_SHOW);
|
---|
750 | ShowWindow(GetDlgItem(hDebugWnd,IDC_WATCHLIST),SW_SHOW);
|
---|
751 | }
|
---|
752 |
|
---|
753 |
|
---|
754 |
|
---|
755 |
|
---|
756 | //////////////////////////////////////
|
---|
757 | // エディタに埋め込み表示のデバッガ
|
---|
758 | //////////////////////////////////////
|
---|
759 |
|
---|
760 | BOOL CALLBACK DebuggerButtonsProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
761 | extern HINSTANCE hInst;
|
---|
762 | extern DWORD dwStepRun;
|
---|
763 |
|
---|
764 | //デバッガ用ツールバー
|
---|
765 | #define BMPNUM_DEBUGGERTOOLBAR 3
|
---|
766 | #define BTNNUM_DEBUGGERTOOLBAR 4
|
---|
767 | TBBUTTON DebuggerToolBar[]={
|
---|
768 | {0,IDC_DEBUG_START,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
|
---|
769 | {0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0},
|
---|
770 | {1,IDC_DEBUG_STEPOVER,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
|
---|
771 | {2,IDC_DEBUG_STEPIN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
|
---|
772 | };
|
---|
773 | TOOLTIPTEXT *pTipText;
|
---|
774 |
|
---|
775 | static HIMAGELIST hImageList,hImageList_Disabled;
|
---|
776 |
|
---|
777 | switch(message){
|
---|
778 | case WM_INITDIALOG:
|
---|
779 | //ツールバーを生成
|
---|
780 | extern HWND hDebuggerToolbar;
|
---|
781 | hDebuggerToolbar=CreateToolbarEx(hwnd,WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|TBSTYLE_FLAT|TBSTYLE_TOOLTIPS|WS_CLIPSIBLINGS,
|
---|
782 | NULL,
|
---|
783 | 0,0,0,
|
---|
784 | DebuggerToolBar,
|
---|
785 | BTNNUM_DEBUGGERTOOLBAR, /*アイテムの個数*/
|
---|
786 | 0,0,16,15,sizeof(TBBUTTON));
|
---|
787 |
|
---|
788 | hImageList = ImageList_LoadImage(hInst, MAKEINTRESOURCE(IDR_DEBUGGERTOOLBAR),
|
---|
789 | 16, 0, RGB(192,192,192),IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
---|
790 | SendMessage(hDebuggerToolbar, TB_SETIMAGELIST, 0, (LPARAM)hImageList);
|
---|
791 | hImageList_Disabled = ImageList_LoadImage(hInst, MAKEINTRESOURCE(IDR_DEBUGGERTOOLBAR_DISABLED),
|
---|
792 | 16, 0, RGB(192,192,192),IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
---|
793 | SendMessage(hDebuggerToolbar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)hImageList_Disabled);
|
---|
794 |
|
---|
795 | break;
|
---|
796 | case WM_COMMAND:
|
---|
797 | switch(LOWORD(wParam)){
|
---|
798 | case IDC_DEBUG_START:
|
---|
799 | DestroyWindow(GetParent(hwnd));
|
---|
800 | return 1;
|
---|
801 | case IDC_DEBUG_STEPIN:
|
---|
802 | Debugger_StepIn();
|
---|
803 | return 1;
|
---|
804 | case IDC_DEBUG_STEPOVER:
|
---|
805 | Debugger_StepOver();
|
---|
806 | return 1;
|
---|
807 | }
|
---|
808 | break;
|
---|
809 | case WM_NOTIFY:
|
---|
810 | pTipText=(TOOLTIPTEXT *)lParam;
|
---|
811 | if(pTipText->hdr.code==TTN_NEEDTEXT){
|
---|
812 | //ツールチップを表示
|
---|
813 | switch(pTipText->hdr.idFrom){
|
---|
814 | case IDC_DEBUG_START:
|
---|
815 | pTipText->lpszText="実行";
|
---|
816 | break;
|
---|
817 | case IDC_DEBUG_STEPOVER:
|
---|
818 | pTipText->lpszText="ステップ アウト";
|
---|
819 | break;
|
---|
820 | case IDC_DEBUG_STEPIN:
|
---|
821 | pTipText->lpszText="ステップ イン";
|
---|
822 | break;
|
---|
823 | }
|
---|
824 | }
|
---|
825 | break;
|
---|
826 | case WM_SIZE:
|
---|
827 | MoveWindow(hDebuggerToolbar,0,0,LOWORD(lParam),HIWORD(lParam),1);
|
---|
828 | return 1;
|
---|
829 |
|
---|
830 | case WM_DESTROY:
|
---|
831 | ImageList_Destroy(hImageList);
|
---|
832 | ImageList_Destroy(hImageList_Disabled);
|
---|
833 | return 1;
|
---|
834 | }
|
---|
835 | return 0;
|
---|
836 | }
|
---|
837 |
|
---|
838 | WNDPROC OldTabProc;
|
---|
839 | LRESULT CALLBACK TabProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
840 | extern HINSTANCE hInst;
|
---|
841 |
|
---|
842 | static HMENU hDummyMenu,hMenu=0;
|
---|
843 |
|
---|
844 | switch(message){
|
---|
845 | case WM_CONTEXTMENU:
|
---|
846 | if(hMenu==0){
|
---|
847 | hDummyMenu=LoadMenu(hInst,MAKEINTRESOURCE(IDR_DEBUGGER_VARLIST_MENU));
|
---|
848 | hMenu=GetSubMenu(hDummyMenu,0);
|
---|
849 | }
|
---|
850 |
|
---|
851 | MENUITEMINFO mi;
|
---|
852 | mi.cbSize=sizeof(MENUITEMINFO);
|
---|
853 | mi.fMask=MIIM_STATE;
|
---|
854 | mi.fState=MFS_CHECKED;
|
---|
855 |
|
---|
856 | if(pobj_nv->bShow_DefaultSystem_Var)
|
---|
857 | SetMenuItemInfo(hMenu,IDM_SHOW_DEFAULTSYSTEM_VAR,0,&mi);
|
---|
858 | if(pobj_nv->bShow_Rad_Var)
|
---|
859 | SetMenuItemInfo(hMenu,IDM_SHOW_RAD_VAR,0,&mi);
|
---|
860 | if(pobj_nv->bShow_GUID_Var)
|
---|
861 | SetMenuItemInfo(hMenu,IDM_SHOW_GUID_VAR,0,&mi);
|
---|
862 |
|
---|
863 | TrackPopupMenu(hMenu,TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
|
---|
864 |
|
---|
865 | break;
|
---|
866 | case WM_COMMAND:
|
---|
867 | mi.cbSize=sizeof(MENUITEMINFO);
|
---|
868 | mi.fMask=MIIM_STATE;
|
---|
869 | switch(LOWORD(wParam)){
|
---|
870 | case IDM_SHOW_DEFAULTSYSTEM_VAR:
|
---|
871 | if(pobj_nv->bShow_DefaultSystem_Var){
|
---|
872 | pobj_nv->bShow_DefaultSystem_Var=0;
|
---|
873 | mi.fState=MFS_UNCHECKED;
|
---|
874 | }
|
---|
875 | else{
|
---|
876 | pobj_nv->bShow_DefaultSystem_Var=1;
|
---|
877 | mi.fState=MFS_CHECKED;
|
---|
878 | }
|
---|
879 | SetMenuItemInfo(hMenu,IDM_SHOW_DEFAULTSYSTEM_VAR,0,&mi);
|
---|
880 | RefreshGlobalVar_with_WindowLock();
|
---|
881 | break;
|
---|
882 | case IDM_SHOW_RAD_VAR:
|
---|
883 | if(pobj_nv->bShow_Rad_Var){
|
---|
884 | pobj_nv->bShow_Rad_Var=0;
|
---|
885 | mi.fState=MFS_UNCHECKED;
|
---|
886 | }
|
---|
887 | else{
|
---|
888 | pobj_nv->bShow_Rad_Var=1;
|
---|
889 | mi.fState=MFS_CHECKED;
|
---|
890 | }
|
---|
891 | SetMenuItemInfo(hMenu,IDM_SHOW_RAD_VAR,0,&mi);
|
---|
892 | RefreshGlobalVar_with_WindowLock();
|
---|
893 | break;
|
---|
894 | case IDM_SHOW_GUID_VAR:
|
---|
895 | if(pobj_nv->bShow_GUID_Var){
|
---|
896 | pobj_nv->bShow_GUID_Var=0;
|
---|
897 | mi.fState=MFS_UNCHECKED;
|
---|
898 | }
|
---|
899 | else{
|
---|
900 | pobj_nv->bShow_GUID_Var=1;
|
---|
901 | mi.fState=MFS_CHECKED;
|
---|
902 | }
|
---|
903 | SetMenuItemInfo(hMenu,IDM_SHOW_GUID_VAR,0,&mi);
|
---|
904 | RefreshGlobalVar_with_WindowLock();
|
---|
905 | break;
|
---|
906 | }
|
---|
907 | break;
|
---|
908 | case WM_DESTROY:
|
---|
909 | DestroyMenu(hMenu);
|
---|
910 | hMenu=0;
|
---|
911 | break;
|
---|
912 | }
|
---|
913 | return CallWindowProc(OldTabProc,hwnd,message,wParam,lParam);
|
---|
914 | }
|
---|
915 |
|
---|
916 | BOOL CALLBACK DlgDebugger(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
917 | extern HANDLE hHeap;
|
---|
918 | extern HINSTANCE hInst;
|
---|
919 | extern DWORD dwStepRun;
|
---|
920 | extern double width_ratio_VarList;
|
---|
921 | RECT rect;
|
---|
922 | int i,i2,i3;
|
---|
923 | char temporary[VN_SIZE];
|
---|
924 | LV_DISPINFO *lvinfo;
|
---|
925 | LVITEM ListView_Item;
|
---|
926 |
|
---|
927 | static POINT pos_VarList;
|
---|
928 | static POINT pos_WatchList;
|
---|
929 |
|
---|
930 | switch(message){
|
---|
931 | case WM_INITDIALOG:
|
---|
932 | extern HWND hDebugWnd;
|
---|
933 | hDebugWnd=hwnd;
|
---|
934 |
|
---|
935 | //変数リストの初期位置を取得
|
---|
936 | GetWindowRect(GetDlgItem(hwnd,IDC_VARPOS),&rect);
|
---|
937 | pos_VarList.x=rect.left;
|
---|
938 | pos_VarList.y=rect.top;
|
---|
939 | ScreenToClient(hwnd,&pos_VarList);
|
---|
940 |
|
---|
941 | //ウォッチリストの初期位置を取得
|
---|
942 | pos_WatchList.x=pos_VarList.x+(rect.right-rect.left)+LEVER_THICK;
|
---|
943 | pos_WatchList.y=0;
|
---|
944 |
|
---|
945 | //ツールバーのベースウィンドウを生成
|
---|
946 | static HWND hBase_ToolBar;
|
---|
947 | hBase_ToolBar=CreateDialog(hInst,MAKEINTRESOURCE(IDD_DEBUGGER_TOOLBARBASE),hwnd,DebuggerButtonsProc);
|
---|
948 | MoveWindow(hBase_ToolBar,50,0,20*BTNNUM_DEBUGGERTOOLBAR,22,1);
|
---|
949 |
|
---|
950 | extern WNDPROC OldThreadComboProc;
|
---|
951 | OldThreadComboProc=(WNDPROC)GetWindowLong(GetDlgItem(hwnd,IDC_THREADCOMBO),GWL_WNDPROC);
|
---|
952 | SetWindowLong(GetDlgItem(hwnd,IDC_THREADCOMBO),GWL_WNDPROC,(long)ThreadComboProc);
|
---|
953 |
|
---|
954 | extern WNDPROC OldProcComboProc;
|
---|
955 | OldProcComboProc=(WNDPROC)GetWindowLong(GetDlgItem(hwnd,IDC_PROCCOMBO),GWL_WNDPROC);
|
---|
956 | SetWindowLong(GetDlgItem(hwnd,IDC_PROCCOMBO),GWL_WNDPROC,(long)ProcComboProc);
|
---|
957 |
|
---|
958 |
|
---|
959 | ///////////////////////////
|
---|
960 | // タブコントロールを生成
|
---|
961 | ///////////////////////////
|
---|
962 |
|
---|
963 | static HWND hTab;
|
---|
964 | HFONT hFont;
|
---|
965 | hFont=(HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
|
---|
966 | hTab=CreateWindow(WC_TABCONTROL,NULL,
|
---|
967 | WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
|
---|
968 | 0,0,0,0,hwnd,0,hInst,0);
|
---|
969 | SendMessage(hTab,WM_SETFONT,(long)hFont,0);
|
---|
970 | OldTabProc=(WNDPROC)GetWindowLong(hTab,GWL_WNDPROC);
|
---|
971 | SetWindowLong(hTab,GWL_WNDPROC,(long)TabProc);
|
---|
972 |
|
---|
973 | //タブを設定
|
---|
974 | TC_ITEM tcItem;
|
---|
975 | tcItem.mask=TCIF_TEXT;
|
---|
976 | tcItem.pszText="グローバル";
|
---|
977 | SendMessage(hTab,TCM_INSERTITEM,0,(LPARAM)&tcItem);
|
---|
978 | tcItem.mask=TCIF_TEXT;
|
---|
979 | tcItem.pszText="ローカル";
|
---|
980 | SendMessage(hTab,TCM_INSERTITEM,1,(LPARAM)&tcItem);
|
---|
981 | tcItem.mask=TCIF_TEXT;
|
---|
982 | tcItem.pszText="This";
|
---|
983 | SendMessage(hTab,TCM_INSERTITEM,2,(LPARAM)&tcItem);
|
---|
984 |
|
---|
985 | //グローバル変数リストのツリーを作成
|
---|
986 | hVarTree_Global=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
|
---|
987 | WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
|
---|
988 | 0,0,0,0,
|
---|
989 | hTab,0,hInst,0);
|
---|
990 |
|
---|
991 | //ローカル変数リストのツリーを作成
|
---|
992 | hVarTree_Local=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
|
---|
993 | WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
|
---|
994 | 0,0,0,0,
|
---|
995 | hTab,0,hInst,0);
|
---|
996 |
|
---|
997 | //This変数リストのツリーを作成
|
---|
998 | hVarTree_This=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
|
---|
999 | WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
|
---|
1000 | 0,0,0,0,
|
---|
1001 | hTab,0,hInst,0);
|
---|
1002 |
|
---|
1003 | ShowWindow(hVarTree_Global,SW_SHOW);
|
---|
1004 |
|
---|
1005 |
|
---|
1006 | //イメージリスト読み込み、設定
|
---|
1007 | static HIMAGELIST hVariOrderImageList;
|
---|
1008 | hVariOrderImageList=ImageList_Create(16,16,ILC_COLOR4|ILC_MASK,4,0);
|
---|
1009 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARARRAY)));
|
---|
1010 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTRUCT)));
|
---|
1011 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARDATA)));
|
---|
1012 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTR)));
|
---|
1013 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARPTRSTRUCT)));
|
---|
1014 | TreeView_SetImageList(hVarTree_Global,hVariOrderImageList,TVSIL_NORMAL);
|
---|
1015 | TreeView_SetImageList(hVarTree_Local,hVariOrderImageList,TVSIL_NORMAL);
|
---|
1016 | TreeView_SetImageList(hVarTree_This,hVariOrderImageList,TVSIL_NORMAL);
|
---|
1017 |
|
---|
1018 |
|
---|
1019 | /////////////////////////
|
---|
1020 | // ウォッチリスト
|
---|
1021 | /////////////////////////
|
---|
1022 |
|
---|
1023 | //コラムの設定
|
---|
1024 | static HWND hListView;
|
---|
1025 | LV_COLUMN ListView_Column;
|
---|
1026 | DWORD dwStyle;
|
---|
1027 |
|
---|
1028 | hListView=GetDlgItem(hwnd,IDC_WATCHLIST);
|
---|
1029 | GetClientRect(hListView,&rect);
|
---|
1030 | dwStyle=ListView_GetExtendedListViewStyle(hListView);
|
---|
1031 | dwStyle|=LVS_EX_FULLROWSELECT;
|
---|
1032 | ListView_SetExtendedListViewStyle(hListView,dwStyle);
|
---|
1033 |
|
---|
1034 | ListView_Column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
---|
1035 | ListView_Column.fmt=LVCFMT_LEFT;
|
---|
1036 |
|
---|
1037 | extern int width_WatchColumn_Expression;
|
---|
1038 | ListView_Column.cx=width_WatchColumn_Expression;
|
---|
1039 | ListView_Column.pszText="ウォッチ式";
|
---|
1040 | ListView_Column.iSubItem=0;
|
---|
1041 | ListView_InsertColumn(hListView,0,&ListView_Column);
|
---|
1042 |
|
---|
1043 | extern int width_WatchColumn_Value;
|
---|
1044 | ListView_Column.cx=width_WatchColumn_Value;
|
---|
1045 | ListView_Column.pszText="値";
|
---|
1046 | ListView_Column.iSubItem=1;
|
---|
1047 | ListView_InsertColumn(hListView,1,&ListView_Column);
|
---|
1048 |
|
---|
1049 | //アイテムの設定
|
---|
1050 | ListView_Item.mask=LVIF_TEXT;
|
---|
1051 | ListView_Item.iSubItem=0;
|
---|
1052 | for(i=0;i<pobj_nv->WatchNum;i++){
|
---|
1053 | ListView_Item.pszText=pobj_nv->ppWatchStr[i];
|
---|
1054 | ListView_Item.iItem=i;
|
---|
1055 | ListView_InsertItem(hListView,&ListView_Item);
|
---|
1056 | }
|
---|
1057 | ListView_Item.pszText="...";
|
---|
1058 | ListView_Item.iItem=i;
|
---|
1059 | ListView_InsertItem(hListView,&ListView_Item);
|
---|
1060 |
|
---|
1061 |
|
---|
1062 | ///////////////////////
|
---|
1063 | // 変数リストの初期化
|
---|
1064 | ///////////////////////
|
---|
1065 | InitVarList((DWORD)lParam);
|
---|
1066 |
|
---|
1067 | break;
|
---|
1068 | case WM_NOTIFY:
|
---|
1069 | NMHDR *hdr;
|
---|
1070 | hdr=(NMHDR *)lParam;
|
---|
1071 | if(hdr->hwndFrom==hTab&&hdr->code==TCN_SELCHANGE){
|
---|
1072 | i=TabCtrl_GetCurSel(hTab);
|
---|
1073 |
|
---|
1074 | if(i==0){
|
---|
1075 | //グローバル変数を表示
|
---|
1076 | ShowWindow(hVarTree_Global,SW_SHOW);
|
---|
1077 | ShowWindow(hVarTree_Local,SW_HIDE);
|
---|
1078 | ShowWindow(hVarTree_This,SW_HIDE);
|
---|
1079 | }
|
---|
1080 | else if(i==1){
|
---|
1081 | //ローカル変数を表示
|
---|
1082 | ShowWindow(hVarTree_Global,SW_HIDE);
|
---|
1083 | ShowWindow(hVarTree_Local,SW_SHOW);
|
---|
1084 | ShowWindow(hVarTree_This,SW_HIDE);
|
---|
1085 | }
|
---|
1086 | else if(i==2){
|
---|
1087 | //This変数を表示
|
---|
1088 | ShowWindow(hVarTree_Global,SW_HIDE);
|
---|
1089 | ShowWindow(hVarTree_Local,SW_HIDE);
|
---|
1090 | ShowWindow(hVarTree_This,SW_SHOW);
|
---|
1091 | }
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 | if(hdr->hwndFrom==hListView){
|
---|
1095 | lvinfo=(LV_DISPINFO *)hdr;
|
---|
1096 | if(hdr->code==NM_DBLCLK){
|
---|
1097 | i2=ListView_GetItemCount(hListView);
|
---|
1098 | for(i=0;i<i2;i++){
|
---|
1099 | if(ListView_GetItemState(hListView,i,LVIS_SELECTED)) break;
|
---|
1100 | }
|
---|
1101 | if(i==i2) break;
|
---|
1102 |
|
---|
1103 | ListView_EditLabel(hListView,i);
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 | static HWND hEdit;
|
---|
1107 | if(hdr->code==LVN_BEGINLABELEDIT){
|
---|
1108 | hEdit=ListView_GetEditControl(hListView);
|
---|
1109 |
|
---|
1110 | GetWindowText(hEdit,temporary,VN_SIZE);
|
---|
1111 | if(lstrcmp(temporary,"...")==0) SetWindowText(hEdit,"");
|
---|
1112 | }
|
---|
1113 | if(hdr->code==LVN_ENDLABELEDIT){
|
---|
1114 | GetWindowText(hEdit,temporary,VN_SIZE);
|
---|
1115 | if(temporary[0]=='\0'){
|
---|
1116 | if(ListView_GetItemCount(hListView)-1==lvinfo->item.iItem) break;
|
---|
1117 |
|
---|
1118 | //空白入力の場合はそのアイテムを削除する
|
---|
1119 | ListView_DeleteItem(hListView,lvinfo->item.iItem);
|
---|
1120 | break;
|
---|
1121 | }
|
---|
1122 | ListView_SetItemText(hListView,lvinfo->item.iItem,0,temporary);
|
---|
1123 |
|
---|
1124 | //演算結果を表示
|
---|
1125 | SetCalcToWatchList(hListView,lvinfo->item.iItem,temporary);
|
---|
1126 |
|
---|
1127 | if(lvinfo->item.iItem==ListView_GetItemCount(hListView)-1){
|
---|
1128 | //リストアイテムを追加
|
---|
1129 | ListView_Item.mask=LVIF_TEXT;
|
---|
1130 | ListView_Item.pszText="...";
|
---|
1131 | ListView_Item.iItem=lvinfo->item.iItem+1;
|
---|
1132 | ListView_Item.iSubItem=0;
|
---|
1133 | ListView_InsertItem(hListView,&ListView_Item);
|
---|
1134 | }
|
---|
1135 | }
|
---|
1136 |
|
---|
1137 | if(hdr->code==LVN_KEYDOWN){
|
---|
1138 | LV_KEYDOWN *plvKeydown;
|
---|
1139 | plvKeydown=(LV_KEYDOWN *)hdr;
|
---|
1140 | if(plvKeydown->wVKey==VK_DELETE){
|
---|
1141 | i2=ListView_GetItemCount(hListView);
|
---|
1142 | for(i=i2-2;i>=0;i--){
|
---|
1143 | if(ListView_GetItemState(hListView,i,LVIS_SELECTED)){
|
---|
1144 | ListView_DeleteItem(hListView,i);
|
---|
1145 | i3=i;
|
---|
1146 | }
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | ListView_SetItemState(hListView,i3,LVIS_SELECTED,LVIS_SELECTED);
|
---|
1150 | }
|
---|
1151 | }
|
---|
1152 | }
|
---|
1153 | break;
|
---|
1154 |
|
---|
1155 | case WM_SIZE:
|
---|
1156 | //変数リストの位置
|
---|
1157 | int width_VarList;
|
---|
1158 | width_VarList=
|
---|
1159 | (int)((double)(LOWORD(lParam)-pos_VarList.x)*width_ratio_VarList);
|
---|
1160 |
|
---|
1161 | MoveWindow(hTab,
|
---|
1162 | pos_VarList.x,
|
---|
1163 | pos_VarList.y,
|
---|
1164 | width_VarList,
|
---|
1165 | HIWORD(lParam)-pos_VarList.y,
|
---|
1166 | 1);
|
---|
1167 |
|
---|
1168 | GetClientRect(hTab,&rect);
|
---|
1169 | TabCtrl_AdjustRect(hTab,FALSE,&rect);
|
---|
1170 | rect.left-=2;
|
---|
1171 | rect.right++;
|
---|
1172 | rect.bottom++;
|
---|
1173 |
|
---|
1174 | MoveWindow(hVarTree_Global,
|
---|
1175 | rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
|
---|
1176 | MoveWindow(hVarTree_Local,
|
---|
1177 | rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
|
---|
1178 | MoveWindow(hVarTree_This,
|
---|
1179 | rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
|
---|
1180 |
|
---|
1181 | pos_WatchList.x=pos_VarList.x+width_VarList+LEVER_THICK;
|
---|
1182 | pos_WatchList.y=0;
|
---|
1183 |
|
---|
1184 | //ウォッチリストの位置
|
---|
1185 | MoveWindow(GetDlgItem(hwnd,IDC_WATCHLIST),
|
---|
1186 | pos_WatchList.x,
|
---|
1187 | pos_WatchList.y,
|
---|
1188 | LOWORD(lParam)-pos_WatchList.x,
|
---|
1189 | HIWORD(lParam)-pos_WatchList.y,
|
---|
1190 | 1);
|
---|
1191 |
|
---|
1192 | return 1;
|
---|
1193 |
|
---|
1194 | case WM_VARLIST_CLOSE:
|
---|
1195 | DestroyWindow(hwnd);
|
---|
1196 | return 1;
|
---|
1197 | case WM_DESTROY:
|
---|
1198 | ImageList_Destroy(hVariOrderImageList);
|
---|
1199 |
|
---|
1200 |
|
---|
1201 | //////////////////////////////////////////////////////////////
|
---|
1202 | // ウォッチリストの以前の内容を破棄し、新しい内容に書き換える
|
---|
1203 | //////////////////////////////////////////////////////////////
|
---|
1204 |
|
---|
1205 | for(i=0;i<pobj_nv->WatchNum;i++){
|
---|
1206 | HeapDefaultFree(pobj_nv->ppWatchStr[i]);
|
---|
1207 | }
|
---|
1208 | HeapDefaultFree(pobj_nv->ppWatchStr);
|
---|
1209 |
|
---|
1210 | pobj_nv->WatchNum=ListView_GetItemCount(hListView)-1;
|
---|
1211 | pobj_nv->ppWatchStr=(char **)HeapAlloc(hHeap,0,pobj_nv->WatchNum*sizeof(char *)+1);
|
---|
1212 | for(i=0;i<pobj_nv->WatchNum;i++){
|
---|
1213 | ListView_GetItemText(hListView,i,0,temporary,VN_SIZE);
|
---|
1214 | pobj_nv->ppWatchStr[i]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
---|
1215 | lstrcpy(pobj_nv->ppWatchStr[i],temporary);
|
---|
1216 | }
|
---|
1217 |
|
---|
1218 |
|
---|
1219 | //////////////////////////////
|
---|
1220 | // デバッグダイアログを破棄
|
---|
1221 | //////////////////////////////
|
---|
1222 |
|
---|
1223 | hDebugWnd=0;
|
---|
1224 |
|
---|
1225 | extern BOOL bClipCompileView;
|
---|
1226 | if(bClipCompileView){
|
---|
1227 | extern HWND hOwnerEditor;
|
---|
1228 | SendMessage(hOwnerEditor,WM_DESTROYDEBUGGERVIEW,0,0);
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | return 1;
|
---|
1232 |
|
---|
1233 |
|
---|
1234 |
|
---|
1235 | ///////////////////////
|
---|
1236 | // デバッグコマンド
|
---|
1237 | ///////////////////////
|
---|
1238 |
|
---|
1239 | case WM_DEBUG_CONTINUE:
|
---|
1240 | DestroyWindow(hwnd);
|
---|
1241 | return 1;
|
---|
1242 | case WM_STEP_IN:
|
---|
1243 | Debugger_StepIn();
|
---|
1244 | return 1;
|
---|
1245 | case WM_STEP_OVER:
|
---|
1246 | Debugger_StepOver();
|
---|
1247 | return 1;
|
---|
1248 | case WM_STEP_CURSOR:
|
---|
1249 | Debugger_StepCursor();
|
---|
1250 | return 1;
|
---|
1251 | }
|
---|
1252 | return 0;
|
---|
1253 | }
|
---|
1254 |
|
---|
1255 |
|
---|
1256 |
|
---|
1257 |
|
---|
1258 | //////////////////////////////////
|
---|
1259 | // ポップアップ表示の変数リスト
|
---|
1260 | //////////////////////////////////
|
---|
1261 |
|
---|
1262 | BOOL CALLBACK DlgVarList(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
1263 | extern HANDLE hHeap;
|
---|
1264 | extern HINSTANCE hInst;
|
---|
1265 | extern DWORD dwStepRun;
|
---|
1266 | RECT rect;
|
---|
1267 | POINT pos;
|
---|
1268 | SIZE size;
|
---|
1269 |
|
---|
1270 | switch(message){
|
---|
1271 | case WM_INITDIALOG:
|
---|
1272 | extern HWND hDebugWnd;
|
---|
1273 | hDebugWnd=hwnd;
|
---|
1274 |
|
---|
1275 | pos.x=pobj_nv->VarDlgRect.left;
|
---|
1276 | pos.y=pobj_nv->VarDlgRect.top;
|
---|
1277 | size.cx=pobj_nv->VarDlgRect.right-pobj_nv->VarDlgRect.left;
|
---|
1278 | size.cy=pobj_nv->VarDlgRect.bottom-pobj_nv->VarDlgRect.top;
|
---|
1279 | MoveWindow(hwnd,pos.x,pos.y,size.cx,size.cy,1);
|
---|
1280 |
|
---|
1281 | extern WNDPROC OldThreadComboProc;
|
---|
1282 | OldThreadComboProc=(WNDPROC)GetWindowLong(GetDlgItem(hwnd,IDC_THREADCOMBO),GWL_WNDPROC);
|
---|
1283 | SetWindowLong(GetDlgItem(hwnd,IDC_THREADCOMBO),GWL_WNDPROC,(long)ThreadComboProc);
|
---|
1284 |
|
---|
1285 | extern WNDPROC OldProcComboProc;
|
---|
1286 | OldProcComboProc=(WNDPROC)GetWindowLong(GetDlgItem(hwnd,IDC_PROCCOMBO),GWL_WNDPROC);
|
---|
1287 | SetWindowLong(GetDlgItem(hwnd,IDC_PROCCOMBO),GWL_WNDPROC,(long)ProcComboProc);
|
---|
1288 |
|
---|
1289 | //イメージリスト読み込み、設定
|
---|
1290 | static HIMAGELIST hVariOrderImageList;
|
---|
1291 | hVariOrderImageList=ImageList_Create(16,16,ILC_COLOR4|ILC_MASK,4,0);
|
---|
1292 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARARRAY)));
|
---|
1293 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTRUCT)));
|
---|
1294 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARDATA)));
|
---|
1295 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTR)));
|
---|
1296 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARPTRSTRUCT)));
|
---|
1297 | TreeView_SetImageList(GetDlgItem(hwnd,IDC_VARTREE),hVariOrderImageList,TVSIL_NORMAL);
|
---|
1298 |
|
---|
1299 | InitVarList((DWORD)lParam);
|
---|
1300 | break;
|
---|
1301 | case WM_COMMAND:
|
---|
1302 | switch(LOWORD(wParam)){
|
---|
1303 | case IDCANCEL:
|
---|
1304 | DestroyWindow(hwnd);
|
---|
1305 | return 1;
|
---|
1306 | case IDC_STEPIN:
|
---|
1307 | Debugger_StepIn();
|
---|
1308 | return 1;
|
---|
1309 | case IDC_STEPOVER:
|
---|
1310 | Debugger_StepOver();
|
---|
1311 | return 1;
|
---|
1312 | }
|
---|
1313 | break;
|
---|
1314 | case WM_SIZE:
|
---|
1315 | GetWindowRect(GetDlgItem(hwnd,IDC_VARTREE),&rect);
|
---|
1316 | pos.x=rect.left;
|
---|
1317 | pos.y=rect.top;
|
---|
1318 | ScreenToClient(hwnd,&pos);
|
---|
1319 | MoveWindow(GetDlgItem(hwnd,IDC_VARTREE),0,pos.y,LOWORD(lParam),HIWORD(lParam)-pos.y,TRUE);
|
---|
1320 | SetWindowPos(GetDlgItem(hwnd,IDCANCEL),0,LOWORD(lParam)-91,9,0,0,SWP_NOSIZE);
|
---|
1321 | return 1;
|
---|
1322 | case WM_VARLIST_CLOSE:
|
---|
1323 | DestroyWindow(hwnd);
|
---|
1324 | return 1;
|
---|
1325 | case WM_DESTROY:
|
---|
1326 | ImageList_Destroy(hVariOrderImageList);
|
---|
1327 |
|
---|
1328 | GetWindowRect(hwnd,&pobj_nv->VarDlgRect);
|
---|
1329 |
|
---|
1330 | hDebugWnd=0;
|
---|
1331 |
|
---|
1332 | return 1;
|
---|
1333 | }
|
---|
1334 | return 0;
|
---|
1335 | }
|
---|