如何使用Eclipse的显示视图进行调试?

发布于 2024-10-08 18:54:42 字数 340 浏览 2 评论 0原文

在下面的链接中,它解释了“显示视图允许您以剪贴簿类型的方式操作实时代码(参见图 8)。要操作变量,只需在显示视图中键入变量的名称,然后您就可以迎接熟悉的内容协助。”

http://www.ibm.com/developerworks/library/os-ecbug/

但是,我我无法让它正常工作。我打开了视图,但所有按钮都被禁用。我尝试过在运行和不运行调试时将代码放入视图中,在视图中选择代码,在其他视图中选择代码,但视图上启用的唯一按钮是“清除控制台”。

关于我做错了什么的建议?

At the link below it explains that the "display view allows you to manipulate live code in a scrapbook type fashion (see Figure 8). To manipulate a variable, simply type the name of the variable in the Display view, and you'll be greeted with a familiar content assist."

http://www.ibm.com/developerworks/library/os-ecbug/

However, I am having trouble getting it to work. I have the view open but all the buttons are disabled. I have tried putting code in the view, selecting code in the view, selecting code in other views, while running and while not running debug, but the only button that is ever enabled on the view is "clear console".

Suggestions on what I am doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

煮茶煮酒煮时光 2024-10-15 18:54:42

您可以将 Display 视图视为可以在运行时检查各种变量和布尔表达式的位置。当您的调试器冻结在断点上时,例如开始键入对象变量的名称,当您开始调用方法或字段以访问更深的类数据结构时,您将获得自动完成功能。然后,当您选择/标记需要检查的部分或所有内容时,“显示”视图上的按钮将是可单击的。您始终可以在选择上执行 Ctrl+Shift+I 快捷键来查看选择的当前运行时状态,即变量、对象、布尔表达式等

You can view the Display view as a place where you can inspect all sorts of variables and boolean expressions during runtime. While your debugger is frozen on a breakpoint start typing the name of an object variable for instance and you'll get autocomplete functionality as you start calling methods or fields to reach deeper class datastructures. Then when you select/mark the portion you need to inspect or everything, the buttons on the Display view will be clickable. You can always perform the Ctrl+Shift+I shortcut on the selection to view what's the current runtime state of your selection i.e. variable, object, boolean exrepssion etc

夏の忆 2024-10-15 18:54:42

我认为这个强大功能应该更频繁地使用。

  1. 在调试视角中: Window ->显示视图-> (搜索)Display
  2. 在代码中放置一个断点
  3. 通过执行此代码触发断点
  4. 到达断点后,转到 Display 视图
  5. 编写一些代码,如 myObject.getSomeData();,您可以自动完成(Ctrl+空格)
  6. 选择要评估的表达式(代码)
  7. 使用现在应启用的众多显示视图按钮之一
  8. 节省一些宝贵的时间...

不知道为什么默认情况下不存在此视图,它应该是!

I think this powerful feature should be used way more often.

  1. In the debug perspective: Window -> Show View -> (search for) Display
  2. Put a break point in your code
  3. Trigger the breakpoint by executing this code
  4. Once on the breakpoint go to the Display view
  5. Write some code like myObject.getSomeData();, you can autocomplete (Ctrl+Space)
  6. Select the expression (code) you want to evaluate
  7. Use one of the many display view buttons which should now be enabled
  8. Save some precious time...

Not sure why this view is not there by default, it should be !

ぇ气 2024-10-15 18:54:42

从 Eclipse Photon 版本 (4.8.0) 开始,

可以在 Debug Shell 内执行相同的功能。我通过以下方式执行此操作:

  1. 确保我处于某个脚本的调试执行中的断点
  2. 打开 Debug Shell
  3. 键入我要运行的代码
  4. 突出显示特定的代码
  5. 行 使用以下任一命令按钮:执行所选文本,或显示评估所选文本的结果

我之所以包含此答案,是因为截至 2018 年,随着 Photon 版本的发布,我无法获得显示视图可以以任何身份工作甚至显示。但我能够通过这种方法完成相同的工作。

As of Eclipse Photon Release (4.8.0)

This same functionality can be performed inside the the Debug Shell. I do this by:

  1. Make sure I'm at a breakpoint in a Debug execution of some script
  2. Open the Debug Shell
  3. Type in the code that I want to run
  4. Highlight the specific line of code
  5. Use either of the buttons for: Execute Selected Text, or Display Result of Evaluating Selected Text

I'm including this answer because as of 2018, with the Photon Release, I was unable to get the Display view to work in any capacity or to even show up. But I was able to perform the same work through this method.

甲如呢乙后呢 2024-10-15 18:54:42

当您停在断点处时,您可以将代码写入或粘贴到“显示”视图中,选择它,然后按 Ctrl+Shift+I 检查(即评估)选择。

When you've stopped at a breakpoint, you can write or paste code into the Display view, select it, and press Ctrl+Shift+I to inspect (i.e. evaluate) the selection.

唯憾梦倾城 2024-10-15 18:54:42

它只能在调试中运行时起作用,并且您只能操作当前线程上下文中存在的变量,这意味着您需要在要检查的变量所在的位置(或之后)放置一个断点变得活跃。当您按住断点时,您可以使用显示选项卡与变量选项卡中可以看到的所有变量进行交互(执行代码片段、评估等)

It will only work while running in debug, and you can only manipulate variables that are live in the context of the currrent thread, which means that you need to place a breakpoint at (or just after) the point where the variables you want to inspect become active. Whilst you hold on the breakpoint you can use the Display tab to interact (execute code snippets, evaluate etc..) with all the variables that you can see in the Variables tab

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文