cwatch only works in the same frame (new issue, worked in earlier versions)
I know that this previously had worked at some place - I guess there's not a testcase for this yet, so nobody catched that when the issue actually came up.
Description: a stored payload can not be read correctly later on, likely only if the current frame is not the original one
(gdb) cbt #0 PROG1 (...) at /test/PROG1.cob:228 #2 MAIN (...) at /test/MAIN.cob:189 (gdb) cw SOME-VAR Hardware watchpoint 2: *(char(*))(0x7fffe88ae600) ... for WVS-SOME-VAR/SOME-REC (gdb) c Continuing. Python Exception <type 'exceptions.IndexError'> list index out of range: (gdb) cbt #0 FIRST (...) at /test/pco/FIRST.cob:1391 #2 PROG1 (...) at /test/SOME.lib:95 #4 MAIN (...) at /test/MAIN.cob:189
This is what happens: the sub program adjusts the variable (
INITIALIZE), so the watchpoint is triggered and its stop method wants to the new data:
in stop in check_and_output_wp in DataToString in PackedDecimalToString
for i in range(self.Length): nybbles.append(data[i] >> 4) nybbles.append(data[i] & 0x0F)
then sees a
self.Length of 10, but
len(self.data) is zero (it wasn't in the first place when the watch was added and the old value was stored.
Not sure what the best approach is, I guess CobolVariable could get a new attribute origin_frame and .DataToString() could check if the frame is still the same, if not save it, try to select it, resolve the data there and finally return to the saved frame; if switching to payload's frame does not work return "".
But maybe there's a better solution to get the reading of the "far away" payload working again - I don't know why data is empty in this case.