Thread: finding the largest ascending subsequence..

  1. #91
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by gil_savir View Post
    Most debuggers (also the one on Eclipse) show call-STACK. However, I would like to see a call-TREE. In some recursive functions, the call-stack is not enough for understanding which call is the parent/child of which call on the stack.
    I'm not sure I understand the difference - the C code will return back to where it came from - which is the call-stack. To understand what that ACTUALLY means, you may have to click on the respective entry in the call-stack [and I'm well aware of how that works in Eclipse, as we use an Eclipse-based IDE here at work].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #92
    Registered User gil_savir's Avatar
    Join Date
    Jan 2009
    Posts
    13
    What I mean is a debugger that keeps stack records, even after "poping" calls from the stack-head. Doing this in a tree manner, such that even after exiting a call in the stack, I could access this call data (vars, etc.), and that I could clearly see - in a tree - which call spanned which call(s).

    To be more clear, asssume I set a recursive function, that traverses a binary tree. When execution reaches its last statement, and stops there (breakpoint or so), the "call-tree" window will show the complete binary tree of recursive calls, and I could choose any node (call) in this tree, and see what was the value of all variables in this call upon it's exit, and from the calls-tree I could understand which node (call) is the parent and which are the children of each call.

    But I guess that such functionality is too complicated and is necessary only for recursive functions, which are only necessary in the academic world, and not in real life.

  3. #93
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by gil_savir View Post
    But I guess that such functionality is too complicated and is necessary only for recursive functions, which are only necessary in the academic world, and not in real life.
    I don't agree that recursive functions are ONLY necessary in the academic world. However a call-tree like you describe is not achievable from data stored in the system [unless we instrument the code itself], so there is no way to achieve this from the debugger [without either compiler support that stores the relevant data somewhere for the debugger to read, or perhaps the debugger introducing breakpoints to record what path the code took, and how it got to where it is]. The call-stack, after all, only contains what has happened in the last set of calls down one path, and if you have traversed the entire binary tree, you will have gone to the same level of the stack many times, so the only data available would be the path of the last traversal.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 22
    Last Post: 05-29-2009, 05:44 PM
  2. Finding the 3 largest numbers of the five entered
    By Bkgrant in forum C Programming
    Replies: 11
    Last Post: 02-13-2009, 01:08 PM
  3. finding the largest number in a binary search
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 07-31-2008, 03:19 AM
  4. Find largest and second largest number (help)
    By Arkon in forum C++ Programming
    Replies: 6
    Last Post: 01-20-2006, 11:21 PM
  5. Finding largest element in array
    By Chaplin27 in forum C++ Programming
    Replies: 2
    Last Post: 04-12-2005, 09:18 PM