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. Getting the call stack programatically

Getting the call stack programatically

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresdebugginghelp
2 Posts 2 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.
  • S Offline
    S Offline
    Steve Driessens
    wrote on last edited by
    #1

    Greetings all. I've been wondering if there's some way to get an application's call stack programatically at run-time. What I have in mind is an error handler (particularly handy during develpment) that can find and list the call stack in the event of some major error happening. I use __FILE__ and __LINE__ quite a bit in debug versions of my code, but thought that just 'fetching' the call stack at the point of reporting an error may be a more elegant ways of doing things. Steve

    S 1 Reply Last reply
    0
    • S Steve Driessens

      Greetings all. I've been wondering if there's some way to get an application's call stack programatically at run-time. What I have in mind is an error handler (particularly handy during develpment) that can find and list the call stack in the event of some major error happening. I use __FILE__ and __LINE__ quite a bit in debug versions of my code, but thought that just 'fetching' the call stack at the point of reporting an error may be a more elegant ways of doing things. Steve

      S Offline
      S Offline
      Stephen Kellett
      wrote on last edited by
      #2

      There are plenty of articles on doing this in MSDN magazine. Also if you search for 'under the hood' in msdev help you will find articles by JOhn Robbins, Matt Pietrek etc on doing this sort of thing. Setting exception handlers that then show you the call stack. Search for SuperASSERT written by John Robbins, which shows you the stack. MFC also provides a AfxDumpStack(). Win32 provides StackWalk(), there was a similar function in Win16.

      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