dfs

Vieta, kur parunāt par to, kas nav atsevišķi izdalīts augstāk
Message
Author
User avatar
vecais_dumais_laacis
Guru
Guru
Posts: 109
Joined: 06 Dec 2010, 19:48
Contact:

Re: dfs

#11 Post by vecais_dumais_laacis » 03 Apr 2013, 12:33

veel juus ciinaaties ar izdomaatu probleemu... echh

debugmodee funkcijas saakumaa

Code: Select all

0046EBE0  push        ebp  
0046EBE1  mov         ebp,esp 
0046EBE3  sub         esp,0C0h //tiek stacks paarbiidiits par 192 baitiem
0046EBE9  push        ebx  
0046EBEA  push        esi  
0046EBEB  push        edi  
saucot rekursiivi naakosho callu

Code: Select all

0046EC07  mov         eax,dword ptr [d] 
0046EC0A  add         eax,1 
0046EC0D  push        eax  
0046EC0E  call        dfs (437BD5h) 
attieciigi 208 baiti weistojaas + 4i baiti paramam un 4i baiti return adresei kopaa 216 baiti stacka uz callu
...un ja bites buutu laachi...

bubu
Guru
Guru
Posts: 398
Joined: 07 Dec 2010, 12:54

Re: dfs

#12 Post by bubu » 04 Apr 2013, 03:45

o_O
Man nekā tāda nav (VS2010)

Code: Select all

00CE1020  push        ebp  
00CE1021  mov         ebp,esp  
00CE1023  cmp         dword ptr [d],1388h  
00CE102A  jge         dfs+1Bh (0CE103Bh)  
00CE102C  mov         eax,dword ptr [d]  
00CE102F  add         eax,1  
00CE1032  push        eax  
00CE1033  call        dfs (0CE1005h)  
00CE1038  add         esp,4  
00CE103B  cmp         ebp,esp  
00CE103D  call        _RTC_CheckEsp (0CE1080h)  
00CE1042  pop         ebp  
00CE1043  ret 

User avatar
vecais_dumais_laacis
Guru
Guru
Posts: 109
Joined: 06 Dec 2010, 19:48
Contact:

Re: dfs

#13 Post by vecais_dumais_laacis » 04 Apr 2013, 09:13

un tev shaadaa izpildiijumaa arii stack overflow nokjer?

2010 expresim debug modee ir overflows un attieciigais papildus sub esp
release modee nav overflows
...un ja bites buutu laachi...

User avatar
kristapuciitis
Posts: 163
Joined: 03 Jun 2011, 14:22

Re: dfs

#14 Post by kristapuciitis » 04 Apr 2013, 20:43

Steka izmēru es nebiju mainījis, tas ir 1MB. Un jā, release modē nav overflowa, paldies!
Gooby pls

bubu
Guru
Guru
Posts: 398
Joined: 07 Dec 2010, 12:54

Re: dfs

#15 Post by bubu » 05 Apr 2013, 00:59

vecais_dumais_laacis wrote:un tev shaadaa izpildiijumaa arii stack overflow nokjer?

2010 expresim debug modee ir overflows un attieciigais papildus sub esp
release modee nav overflows
ar 5000 nav nekāda overflowa. Tas iestājas tikai ap 90000.

Bet es laikam sapratu problēmu - man "Debug Information Format" settings ir "Program Database (/Zi)". Pēc noklusējuma tas ir "Program Database for Edit And Continue (/ZI)". Es vienmēr to slēdzu ārā :)
Edit And Continue man ir sagādājis vairāk problēmu, nekā labuma.
Rekā izrādās tas arī steka izmēru palielina!

User avatar
vecais_dumais_laacis
Guru
Guru
Posts: 109
Joined: 06 Dec 2010, 19:48
Contact:

Re: dfs

#16 Post by vecais_dumais_laacis » 05 Apr 2013, 08:50

nu ne gluzhi palielina bet edit and continue rezervee katram freimam papildus steku
tas ljauj pielikt nedaudz jaunus variabljus
pieliekot lielaakus edit&continue vairaak nedarbojaas korekti -> izmanto veco kodu

alja

Code: Select all

void dfs(int d)
{
	char bu[ 1 ];
	bu[ 0 ] = 0;
	if (d < 4800)
		dfs(d+1);
};
mainot char bu[ 1 ] uz char bu[ 1024 ]
edit&continue izmanto veco kodu jo stackaa nav paredzeeta tik daudz rezerves vieta
...un ja bites buutu laachi...

bubu
Guru
Guru
Posts: 398
Joined: 07 Dec 2010, 12:54

Re: dfs

#17 Post by bubu » 05 Apr 2013, 10:07

Es to ļoti labi saprotu.
Rezrvē vietu palielinot steka freimu :)

Post Reply

Return to “Programmēšana / Programming”