Change local variable or function parameter in google chrome - google-chrome-devtools

I'm using chrome's devtools to debug/modify a non-local javascript file(so I can't edit it).
The code is rather complex and defines function inside of functions and uses these pointers throughout.
The point is that I do not know where I'm exactly at in the process but I can set a breakpoint to a variable I need to modify. BUT I can't figure out how to modify it. I can add a watch or modify it under the locals panel BUT it won't actually change (after stepping once the value reverts to original)
So how can I change the variable? I don't know why it is so difficult. In my traditional debugging you can simply edit the value in the watch or locals and it will modify it. I've tried modifying it at the console but I guess I don't know the complete path to the variable and I always get an undefined variable.
All I want to do is modify a local variable or argument in side some function I set a breakpoint at.

Try doing this in the console. E.g.: window.myVar = "newValue"

First watch the variable, second in Scope tab you can change the value of the var!

Related

What is the best way to inspect a specific variable in jupyter?

Short of printing a variable in a new cell, I don't know a good fast method to view a specific variable in jupyter.
I am aware of the Variable Inspector nbextension; but that shows ALL variables rather than a specific one.
Is there some way to do this which I'm missing?

Change value of import parameter function module abap

I have a FM with structure in importing. When I try to change field value (wa_str-data = '31129999' for example), the change works, but when I get out of the FM, the field value is reset.
Is it possible to change the field value of a Function Module importing parameter which is of structured type?
Thanks to all.
No, you can't change the value of an IMPORTING parameter (unless it happens to be a TYPE REF TO, in which case you can change the value of the referenced object/data). You can only change values of CHANGING parameters. However, there is a dirty trick you might be able to use here. If you want to access the variable foo in the calling program Z_BAR, then you can do this:
FIELD-SYMBOLS <foo>.
ASSIGN ('(Z_BAR)FOO-DATA') TO <foo>.
IF sy-subrc = 0.
<foo> = newValue.
ENDIF.
(By the way, Z_BAR does not even need to be the direct caller of the function module. It just needs to be somewhere in the call stack.)
Why am I calling this a "dirty" trick?
It creates "spooky effects at a distance". Anyone examining Z_BAR would never expect a function module to change foo when it's not in its parameter list.
The variable name gets resolved at runtime, so there is no syntax check when you misspell it.
It breaks when the variable in the calling program gets renamed, and you won't know until it fails at runtime.
You need to know the name of the calling program in advance. When the function module gets called from another program, then it's not going to work anymore.
So I would only recommend this as a last resort measure.

Show the value of the property and not just the type

In our dear VS Code when we hover in any variable the vscode by default shows the type of this variable, when it is an object, it shows the structure of the object.
e.g:
I would like to know if in addition to showing the type or structure it is possible to show the value of the properties.
If this is not possible in the vscode itself, is there any extension that does something like this?
The closest you can get to what you want (show variables value), is to add the variable in the debug window to the watch list. In debug mode, when you hit a breakpoint, your watch will evaluate the value at the current time (whether its been set, or not etc.) and will output what it is in that window for you.
See below:

How to make a variable defined in a matlab function accessible outside the function

I have built a matlab function and I want to access one of its variables ,say x in the workspace. If I write x in the workspace it says Undefined function or variable "x"
Using the global modifier will definitely make your variable visible to the workspace, but it will also make it visible to any other function you call that happens to use that variable name. So if you insist on doing it this way, make sure that your variable name is unique.
A better way, in my opinion, is to pass back the value of the variable as a return value from the function, though this may require changes to calling functions.
Other options are detailed here:
http://www.mathworks.com/help/matlab/matlab_prog/share-data-between-workspaces.html

In eclipse debugger, variables view, can I change "Value" value

I wonder if there is a way to change what we see in Value in Variables view in eclipse debugger?
For example instead of "ObjectClass (id=94)" I would like to see what that object toString() method returns, is it possible?
(I know that in "Expressions" we can add variable.toString() and it will show it, but I must add it manually, over time is tedious).
Yes you can do this by using your own debug detailed Formatters. Check here that the Person object is changed from Person(id=38) to Name=John Surname=Smit.
Also refer this link.