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