-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local variables with same name between functions not tracking or updating context #923
Comments
Maybe I fixed it. It was hard to reproduce it because all the code above would get optimized out. I created a test case nevertheless and could see the problem GDB was giving us stale values or said nothing changed when in fact it had. It was looking at values from the previous stack traces and not getting updated for the new stack traces. Very difficult to explain We now force gdb to re-evaluate Can you please try this out and give me feedback. Pick up the latest from https://github.com/Marus/cortex-debug/releases and Install from the VSIX file manually. Note that there are other unrelated changes. |
Thanks Haneef!
I did double check that I'm using 1.12.0.Pre2. I take that back! The watch window does now work as expected! The "VARIABLES" that shows local does not. That still shows the previous context. I didn't check both for the first test. |
Ok, that's progress. Trying to reproduce the problem... |
Can you try the latest pre-release please. I was able to duplicate and fix the issue. I have no idea if there was a change in gdb that is causing this of if this was always a problem from 2+ years ago. |
Thanks H! I’d love to test it, but I’m going to be out of office for the week. I’ll be able to test the day I get back. I’ll won’t abandon this. I had wondered about when this became a problem. I use status in most of my functions and single return call, so I really assume I would have seen this before! But, you never know. |
Experiencing the same issue here. Can confirm that using the gdb "print" command in the Debug Console outputs the expected value, while the Variables window shows values from previous function calls. Seems to only happen with variables that share the same name. Update: I installed v1.12.1-pre3 and the issue is fixed 😀 |
Describe the bug
The function I am in defines a local
uint32_t status
. The function I call does the same, inside this function the debugger does not update the address of the new local with the same name. Nothing in the watch window is correct for the new-local, everything references local variable one jump/branch back. Hover over the variable works as expected.To Reproduce
Steps to reproduce the behavior:
my_function()
I setstatus
and it gets an example address:0x2400B32C
test_1()
ortest_2()
, the watch and variables window continues to showstatus
value and address as if it's the one frommy_function()
, same address and values.status
.Expected behavior
That
status
is reflected on it's local state as functions are entered and returned from.Screenshots
Status as defined as the local correctly.
Despite having called
test_1()
, returned, and currently insidetest_2()
, the debug window is still pointing to the original definition ofstatus
. Notice however thatstatuA
works as expected. It's unique name isn't confused when moving around, returning from the function makes the watch window lose context as expected.Environment (please complete the following information):
Launch.json
Additional context
status
is not static or global anywhere-D_POSIX_C_SOURCE=200809L
to my makefile forstrnlen()
so that's my next check (That's how few options I have left! pleasesendhelp)The text was updated successfully, but these errors were encountered: