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