Is it possible to view variable values in Eclipse when debugging? Right now when I "mouse over" a variable all I get is the definition. e.g. for [int mLastView] I get [com.company.samples.MyClass.mLastView] instead of 1. The value that was assigned to it.
在调试时可以查看Eclipse中的变量值吗?现在,当我“鼠标经过”一个变量时,我得到的就是定义。我得到[com.company.samples.MyClass.mLastView]而不是1。分配给它的值。
Also, is there anyway to improve debugging in Eclipse?
而且,在Eclipse中还有改进调试的方法吗?
For starter: making the breakpoints visible as in VS (see below)?
起动器:使断点可见于VS(见下)?
Eclipse Break Point
Eclipse断点
Eclipse Break Point http://i28.tinypic.com/hwmtcx.png
Eclipse断点http://i28.tinypic.com/hwmtcx.png
Visual Studio Break Point
Visual Studio断点
Visual Studio Break Point http://i32.tinypic.com/359egbp.png
Visual Studio断点http://i32.tinypic.com/359egbp.png。
5 个解决方案
#1
5
I posted this over at Stack Overflow and one of the suggestions was to go into Window -> Preferences -> Java -> Editor -> Hovers and select the Variable Values option and assign a modifier.
我在Stack Overflow上发布了这个消息,其中一个建议是进入Window ->首选项-> Java ->编辑器-> Hovers,并选择变量值选项并分配一个修改器。
When I was first trying to resolve this issue, this was one of the options I looked at, but oddly enough, there was no Variable Values preference available, it was missing. Once my “fix” above was applied, it magically appeared:
当我第一次尝试解决这个问题时,这是我看到的选项之一,但奇怪的是,没有变量值偏好,它丢失了。一旦我的“修复”被应用,它就神奇地出现了:
Click to see the pictureBroken Link
点击查看图片断开链接。
#2
4
Actually, since eclipse3.4, not only do you see the value of a variable when you pass the mouse over it, you can actually inspect it:
实际上,自从eclipse3.4之后,当您将鼠标经过它时,您不仅可以看到一个变量的值,还可以检查它:
When debugging, hovers for variables have been enhanced to display an object inspector. The inspector will display logical structures according to the toggle setting in the visible Variables or Expressions view.
调试时,对变量的hovers进行了增强,以显示对象检查器。检查器将根据可视变量或表达式视图中的toggle设置显示逻辑结构。
#3
3
If you hit the breakpoint while you are debugging, you do see the value of the variable when you mouse over. You can also select an expression, and inspect the value of it's evaluation using the "Inspect" menu option. You can also use the "Variables" view to see the current value of all in-scope variables.
如果您在调试过程中碰到了断点,那么当鼠标结束时,您会看到变量的值。您还可以选择一个表达式,并使用“inspect”菜单选项检查它的评估值。您还可以使用“Variables”视图来查看所有in-scope变量的当前值。
#4
2
About breakpoint visibility:
关于断点的可见性:
Right-click on the right outline of the editor, you'll see some Preferences, and there in Annotations you can select Breakpoints. I personally added Text as Highlighted and some pinky colour. Shame that the highlighting is really buggy, sticks here and there, breaks between lines, etc. But it somehow works for most cases.
右击编辑器的右轮廓,您将看到一些首选项,在注释中您可以选择断点。我个人增加了文本的高亮和一些粉红色。遗憾的是,高亮显示实际上是有bug的,在这里和那里,在线条之间,等等,但是它在大多数情况下是有效的。
(Another shame is that breakpoint bullet is often hidden behind some suggestion icon or what - why they can't make the gutter wider like Idea does, I don't know.)
(另一个遗憾是,断点子弹通常隐藏在一些建议的图标后面,或者是什么——为什么他们不能让这个更大的东西像Idea一样,我不知道。)
#5
1
I got similar but a little different problem with the thread-starter. Sometimes during debugging, I mouse over a variable, I see it current value. Sometimes it's just the definition, like in coding mode. So what caused the first case, what the second?
我得到了类似的但与线程启动器稍有不同的问题。有时在调试过程中,我鼠标经过一个变量,我看到它的当前值。有时它只是定义,就像编码模式一样。那么是什么导致了第一个病例,第二个呢?
PS: Of course I can always choose to view Variables (Alt+Shift+Q,V) but it's faster if you have mouse over value instantly. Thanks
当然,我总是可以选择查看变量(Alt+Shift+Q,V),但是如果你马上就有了鼠标,它会更快。谢谢
#1
5
I posted this over at Stack Overflow and one of the suggestions was to go into Window -> Preferences -> Java -> Editor -> Hovers and select the Variable Values option and assign a modifier.
我在Stack Overflow上发布了这个消息,其中一个建议是进入Window ->首选项-> Java ->编辑器-> Hovers,并选择变量值选项并分配一个修改器。
When I was first trying to resolve this issue, this was one of the options I looked at, but oddly enough, there was no Variable Values preference available, it was missing. Once my “fix” above was applied, it magically appeared:
当我第一次尝试解决这个问题时,这是我看到的选项之一,但奇怪的是,没有变量值偏好,它丢失了。一旦我的“修复”被应用,它就神奇地出现了:
Click to see the pictureBroken Link
点击查看图片断开链接。
#2
4
Actually, since eclipse3.4, not only do you see the value of a variable when you pass the mouse over it, you can actually inspect it:
实际上,自从eclipse3.4之后,当您将鼠标经过它时,您不仅可以看到一个变量的值,还可以检查它:
When debugging, hovers for variables have been enhanced to display an object inspector. The inspector will display logical structures according to the toggle setting in the visible Variables or Expressions view.
调试时,对变量的hovers进行了增强,以显示对象检查器。检查器将根据可视变量或表达式视图中的toggle设置显示逻辑结构。
#3
3
If you hit the breakpoint while you are debugging, you do see the value of the variable when you mouse over. You can also select an expression, and inspect the value of it's evaluation using the "Inspect" menu option. You can also use the "Variables" view to see the current value of all in-scope variables.
如果您在调试过程中碰到了断点,那么当鼠标结束时,您会看到变量的值。您还可以选择一个表达式,并使用“inspect”菜单选项检查它的评估值。您还可以使用“Variables”视图来查看所有in-scope变量的当前值。
#4
2
About breakpoint visibility:
关于断点的可见性:
Right-click on the right outline of the editor, you'll see some Preferences, and there in Annotations you can select Breakpoints. I personally added Text as Highlighted and some pinky colour. Shame that the highlighting is really buggy, sticks here and there, breaks between lines, etc. But it somehow works for most cases.
右击编辑器的右轮廓,您将看到一些首选项,在注释中您可以选择断点。我个人增加了文本的高亮和一些粉红色。遗憾的是,高亮显示实际上是有bug的,在这里和那里,在线条之间,等等,但是它在大多数情况下是有效的。
(Another shame is that breakpoint bullet is often hidden behind some suggestion icon or what - why they can't make the gutter wider like Idea does, I don't know.)
(另一个遗憾是,断点子弹通常隐藏在一些建议的图标后面,或者是什么——为什么他们不能让这个更大的东西像Idea一样,我不知道。)
#5
1
I got similar but a little different problem with the thread-starter. Sometimes during debugging, I mouse over a variable, I see it current value. Sometimes it's just the definition, like in coding mode. So what caused the first case, what the second?
我得到了类似的但与线程启动器稍有不同的问题。有时在调试过程中,我鼠标经过一个变量,我看到它的当前值。有时它只是定义,就像编码模式一样。那么是什么导致了第一个病例,第二个呢?
PS: Of course I can always choose to view Variables (Alt+Shift+Q,V) but it's faster if you have mouse over value instantly. Thanks
当然,我总是可以选择查看变量(Alt+Shift+Q,V),但是如果你马上就有了鼠标,它会更快。谢谢