dcsimg
Results 1 to 7 of 7

Thread: How to jump to the sub() that invokes current sub during debugging?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    How to jump to the sub() that invokes current sub during debugging?

    Hi folks. I have this sub: Execute2() that's called by Execute1() .
    And Execute1() is used many(hundreds) times in the main code.
    during runtime I'm getting some errors and when i click pause, the cursor is at the line in the sub that the code's hanging at, which is part of Execute2().
    But I really want to know which Execute1() that called Execute2() causes the error. I'm wondering whether there's some shortcuts or options in some menu that do this. pardon the noob.
    Thanks

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,569

    Re: How to jump to the sub() that invokes current sub during debugging?

    Put in break points. You can find a tutorial here. They will save you alot of time and headache :]

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    Re: How to jump to the sub() that invokes current sub during debugging?

    well.. you know, breakpoint will sortof do..but still Execute1() appears at like a hundred places..just looking for a quickie
    but if not I guess I'd have to step into it

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,924

    Re: How to jump to the sub() that invokes current sub during debugging?

    Not breakpoints for this. Open up the call stack window. It's an icon on the toolbar that looks kind of like several papers overlapping each other.

    In the stack window you will see the series of function calls with the one that you are currently in at the top. You can click on any of the other lines in the stack window and be taken to the line of code that called the method that you are currently in. Therefore, from your description, Execute2 will be the top line, and the Execute1 that called it will be the next line down. Whatever called Execute1 will be the third line down, and so forth as far back as the nesting of calls goes.
    My usual boring signature: Nothing

  5. #5
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: How to jump to the sub() that invokes current sub during debugging?

    Good advice shaggy. I would also recommend not using pause in this case. Click the Debug menu, select Exceptions, and check both checkboxes beside "Common Language Runtime Exceptions". This will automatically break at the exact line when the exception occurs.
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    34,924

    Re: How to jump to the sub() that invokes current sub during debugging?

    Yeah, I really like testing with CLR Exceptions set to break when thrown (which is the checkbox that is NOT checked by default). When working with code that I didn't write, I found some very interesting things when I turned that one on.
    My usual boring signature: Nothing

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    Re: How to jump to the sub() that invokes current sub during debugging?

    yeh. callstack works!! Thx guys

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width