gdb-imshow icon indicating copy to clipboard operation
gdb-imshow copied to clipboard

Python Exception <class 'ValueError'> Variable not found

Open yzsatgithub opened this issue 6 years ago • 2 comments

When I call cv_imshow mat_name, I got the following exception:

Python Exception <class 'ValueError'> Variable 'mat_name' not found.: 
Error occurred in Python command: Variable 'mat_name' not found.

The variable actually exists.

yzsatgithub avatar Nov 13 '18 07:11 yzsatgithub

Are you sure that the mat_name variable is on scope at the line where you set your breakpoint? Could you share a minimal working example where this error appears?

renatoGarcia avatar Nov 27 '18 12:11 renatoGarcia

I believe this may happen when you try to show a cv::Mat, which is a field variable - e.g. a member of an object. This is because in cv_imshow.py:58 you use frame.read_var, which checks only for variables with the specific name from the specific frame, but not for field variables (e.g. this->arg instead of arg), which might also be visible from the frame.

I think the workaround should involve using gdb.lookup_symbol to translate the string arg to a gdb.Symbol, instead of using frame.read_var directly to the string, but I'm unable to make it work. I may have some buggy version of gdb, since gdb.lookup_symbol(arg) returns (None, True), when arg is a name of a field variable, which should not happen according to gdb docs (https://sourceware.org/gdb/onlinedocs/gdb/Symbols-In-Python.html).

matemat13 avatar Apr 08 '19 15:04 matemat13