Eclipse - Debugging - eclipse

I am very new to Selenium and Eclipse.
I have a question (actually 2 questions) about debugging.
When I am debugging in Eclipse (Version: 2021-06 (4.20.0)), so I do not get visibility of all variables I have defined in the method.
For example, (see the screen shot attached) I have added string variable testSigned and assigned a value to it. Actually the purpose is to verify the text value contained in web element table_AdditionalDocumentation.
I defined Toggle Line breakpoint at line 395.
I started to execute in debug mode, got to the line 395.
However, I do not see the value of testSigned in Variables tab.
I noticed it does show values only of the variable which would be returned by the method, correct me if I am wrong.
Please, tell me how to get those values I have defined visible.
2.Additionally, please, let me know which button to press if for example after line 395 I want not to go line by line (F6), but just to run the code to the end.

For the first question, I'm not certain, but it might be because you haven't initialized that variable with a value. Try setting it to an empty string on the declaration line.
For the second question, if you set a breakpoint on the line you want to get to, just Resume (F8), and it will stop at the next breakpoint it hits, hopefully the one at the end of your method. Alternatively, if you just want to stop at the line right after the method returns (which will show the return value), you can click "Step Out" (F7) for that.

Related

Eclipse breakpoint conditional skipping

I read several posts on this but I could not fix my problem which is that eclipse skips a conditional I defined on a variable.
if(currentContent=="content") {
return true;
}
Can you please advice what I should do for the conditional to trigger the breakpoint when the value of my string variable is equal "content".
You can't rely on == with Strings. Use .equals().
nitind's point about using .equals is important, but I think a bigger issue is that the breakpoint condition is evaluated BEFORE the line executes, not after. I get the feeling you want to hit the breakpoint when the resulting value of "currentContent" matches your expectations AFTER the assignment, not before.
In this case, I suggest you move your breakpoint to the executable line that comes after this line.

How to set breakpoints in windbg that does not stop the execution of the program just logs the function called

I am debugging a windows component and want to view all the functions of a particular dll that are called (also in the exact order they are called). I can do this by attaching the component to windbg and setting breakpoints over all the exported functions (bm *module_name!*) of the dll in question.
This works as expected. Whenever an exported function of that dll is called windbg breaks the execution and prints on the screen information about the breakpoint that is hit. After that I can manually resume execution by pressing F5 or giving the go command.
The problem:
Some functions of the dll have to return very quickly (immediately) else the component crashes. In that case the breakpoint causes the component to crash. I can remove the breakpoint in question but then there would be no log of it being hit.
I looked around and found that I can run a command whenever a breakpoint is hit. bm module_name!func_name ".printf \"func_name\n\";gc" But this is not feasible for every exported function. The dll has about a few 100 exported functions.
What can I do to log (on the screen itself) every exported function that is hit (even the breakpoint number would do if nothing else can be done). Is there a variable name I can use in the printf command that can print the function name (or the breakpoint number if not the function name)?
Figured it out. Thanks to EdChum.
The command: bm *module_name!* ".frame;gc"

debug the last sentence of a program

I have used Eclipse and VS. When I insert a breakpoint and debug the program, it will stop before the breakpoint.
But what if I want to debug the effect of the last sentence of the program? Inserting a meaningless sentence(say print 'pause' in Python) is OK but seems awkward. Is there any alternatives?
In Visual Studio you can put break point on closing bracket in main (or any) method of Program (or any) class (default naming, may vary), then debugger stops just before closing application.
Is there any reason not to use a breakpoint on the last statement, like you said, then manually proceed one step? Depending on the debugger, this can also be automated. In GDB, one can use commands N, where N is the breakpoint number, to set a list of (debugger) commands to be executed immediately after a breakpoint is hit.

How to inspect a variable in XCODE?

Is there any command using which we can inspect a object in command line while app is running in DEBUG mode. I do not want to put description message in the code.
Try these resources. one two
(gdb) p varName
Yes sure. If you are debuging, breakpoints are automatically set to on. Just set a breakpoint to the line in which the variable is. The program stops as soon it reaches the line with the breakpoint. Just hold the cursor over the variable and all important data is displayed. I do it also that way all the time. ;-)

Debugging with Zend Studio / Eclipse

Is it possible to debug PHP scripts so that it keeps running until an expression is true?
For example, I want to know when $a becomes a certain value. I don't want to keep pressing step into and wait until the variable $a changes the value to it.
The solution is to set a breakpoint, right click on it and set a condition for it.
However, there are no global breakpoints, you must specify a location for every breakpoint you put. So, if you want to know where a value changes, you can't set any global conditions as they would be too CPU consuming.