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