Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error in CHKSTK.ASM

Error in CHKSTK.ASM

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houari_id
    wrote on last edited by
    #1

    Dear all, I run my program using F5 (which will stops in certain line when an error found), and it stops at file CHKSTK.ASM in this highlighted line: probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no I wonder what kind of error that cause this? Thanks in advance

    A C 2 Replies Last reply
    0
    • H houari_id

      Dear all, I run my program using F5 (which will stops in certain line when an error found), and it stops at file CHKSTK.ASM in this highlighted line: probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no I wonder what kind of error that cause this? Thanks in advance

      A Offline
      A Offline
      Alexander M
      wrote on last edited by
      #2

      The code you posted is not enough to find out what is wrong. What, e.g., is the value ecx gets initialized with? Don't try it, just do it! ;-)

      H 1 Reply Last reply
      0
      • A Alexander M

        The code you posted is not enough to find out what is wrong. What, e.g., is the value ecx gets initialized with? Don't try it, just do it! ;-)

        H Offline
        H Offline
        houari_id
        wrote on last edited by
        #3

        the ecx value is 206832, and the eax value is 15741120 I don't understand what does the ecx and the eax mean and how it gets initialized. However, before the debug window bring me to CHKSTK.ASM, the error dialog box said 'Unhandled exception... ..Stack Overflow'. thanks

        1 Reply Last reply
        0
        • H houari_id

          Dear all, I run my program using F5 (which will stops in certain line when an error found), and it stops at file CHKSTK.ASM in this highlighted line: probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no I wonder what kind of error that cause this? Thanks in advance

          C Offline
          C Offline
          cmk
          wrote on last edited by
          #4

          The error said stack overflow. You are looking in the wrong place. chkstk.asm is where the program actually ran out of stack memory, but your problem is a design issue. When the error happens look at the call stack in the debugger to see what function(s) were called to produce the overflow. You either: 1. Tried to allocate too much memory from the stack. e.g. void badfunc( void ) { long badvar[128*1024]; ... } or, 2. Got caught in a deep function call loop that ended with the same effect as 1. e.g. for small values this is fine, for larger values it will blow the stack long badrecurse( long R ) { long r = 1; // alloc 4 bytes off stack - each iteration! if( R > 1 ) r = badrecurse(R-1); return(R * r); } ...cmk Save the whales - collect the whole set

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups