在调试过程中如何跳转到调用当前sub()的sub()? [英] How to jump to the sub() that invokes current sub() during debugging?

查看:95
本文介绍了在调试过程中如何跳转到调用当前sub()的sub()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我有一个子:Execute2(),由Execute1()调用.
并且Execute1()在主代码中使用了数百次.
在运行时,我遇到一些错误,当我单击暂停时,光标在代码所在的子行中,这是Execute2()的一部分.
但是我真的很想知道哪个Execute1()调用了Execute2()导致错误.我想知道某些菜单中是否有某些快捷方式或选项可以执行此操作?Thx--
-------
当前正在使用VB.net 2008 Express.
在功能全面之后,我将移至VS2010.

Hi guys. I have a 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''re some shortcuts or options in some menu that do this?Thx--
-------
currently using VB.net 2008 express.
After it''s fully functional i''m moving to VS 2010.

推荐答案

嘿!

(在我看来)调用堆栈"窗口是您要搜索的内容.

大多数视觉工作室都包含了它(我只检查了2010和2005版本,​​所以在我不知道之前). (您可以在Debug> Windows> Call堆栈下找到它)

您也可以在Sharpdevelop的View> Debug> Callstack下找到它.

您可以使用调用堆栈返回到父"子并在其中查看常量...
Hey!

The ''call stack'' window is the thing you''re searching (in my opinion).

It''s included in most visual studio (i only checked 2010 and 2005 version, so before I don''t know). (You''ll find it under, Debug>Windows>Call stack)

You can also find it in sharpdevelop, under View>Debug>Callstack.

You can use the callstack to go back to ''parent'' subs and view the constants there...


除了解决方案1:

首先,基本的事情之一就是了解堆栈的作用和操作.

现在,当您谈论错误"时,您可能意味着抛出了异常.遇到异常时,此时可以通过读取属性System.Exception.StackTrace:
来转储堆栈. http://msdn.microsoft.com/en-us/library/system.exception. stacktrace.aspx [ ^ ].

这是一个非常重要的功能,可以帮助调试,但是当您需要在诸如CodeProject Questions&答案.

但是,此信息仅作为字符串显示.您可以在运行时遍历堆栈,并且可以通过使用类System.Diagnostics.StackTrace获得最全面的信息.请参阅: http://msdn.microsoft.com/en-us/library/system .exception.stacktrace.aspx [ ^ ].

请注意上面引用的MSDN文章中的代码示例.

—SA
In addition to Solution 1:

First of all, one of basic things is to understand the role and operation of stack.

Now, when you talk about the "error", you probably mean that an exception was thrown. When you catch an exception, you can dump a stack at this point be reading the property System.Exception.StackTrace:
http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx[^].

This is a very important feature which can help debugging, but this is also a very good tool when you need to ask a question somewhere like CodeProject Questions & Answers.

However, this information is presented just as a string. You walk the stack during run time and get most comprehensive information is you use the class System.Diagnostics.StackTrace. Please see: http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx[^].

Pay attention for the code sample in the MSDN article referenced above.

—SA


这篇关于在调试过程中如何跳转到调用当前sub()的sub()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆