Eclipse条件断点,任何字符串中断等于 [英] Eclipse conditional breakpoint, break at any string equals

查看:218
本文介绍了Eclipse条件断点,任何字符串中断等于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大的(遗留的)应用程序,我必须修复,可怕的代码结构和如此多的代码气味,我窒息。我真的不知道gui中的一个字符串的位置。因此,如果我以某种方式可能有一个表达式/断点,一旦任何字符串(我不知道变量的名称,或者它在哪里)就等于foobar,所以我可以从那里回溯。



那么,我在找什么? :)

解决方案

如果您有一个IDE,例如Eclipse,可以为所有变量设置getter和setter,这些设置器中的每一个,调用一个名为checkValue的函数,例如,在这个checkValue中为您要查找的特定值创建条件断点。



将需要更改代码,但作为副产品,将创建一个更干净的代码。






使用jmap并导致内存转储。检查每个转储的值是否正在寻找






使用自省和循环遍历每个变量,寻找值。 / p>

I have a large (legacy) application that I have to make a fix in, with terrible code structure and so much code smell that I'm choking. I can't really figure out where a string in the gui is populated. Therefore it would be nice if i somehow could have an expression/breakpoint once ANY string (I don't know the name of the variable, or where it is) is equal to "foobar" so I can backtrack from there.

So, what am I looking for? :)

解决方案

IF you have an IDE, such as Eclipse, you can set getters and setters for all your variables then, from every one of these setters, call a function called "checkValue" for example, in this "checkValue" make a conditional breakpoint for the specific value you are looking for.

This will require code to be changed, but as a by-product, would create a cleaner code.


Use jmap and cause memory dumps. Inspect every dump for the value you are looking for


Use Introspection and cycle through every variable, looking for the value.

这篇关于Eclipse条件断点,任何字符串中断等于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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