Need to print as expression
cprint adds a lot of quite useful info (internally creating multiple expressions), it is not reasonable to do this there.
But actually GDB's auto-assignment of an expression to a variable is necessary to allow "a possibly complex expression" (like the internal dumping of the field) to be used in different places (
cprint 2 emulates this).
Is it possible to use a special cprint session form for that, something like
cprint/ve which will then show the lovely
$2 = 25
? This would allow something like:
(gdb) cprint/ve oeit-custnum $3 = 00000 (gdb) cprint counter 1 : 05 my-counters/working-data/optfde01 [W-S] : "Records modified: 00003" 2 : 10 custmas-ctr/my-counters/working-data/optfde01 [W-S] : 00003 (gdb) cprint/ve 2 $4 = 00003 (gdb) break optfde01_:SECTION_SOME_SECT if $3 == $4 && $4 == $3 Breakpoint 2 at 0x7fac1f3b1554: file /tmp/optfde01.cob, line 120. (gdb) c ontinuing. Breakpoint 2, 0x00007fac1f3b1554 in optfde01_ (entry=0) at /tmp/optfde01.cob:120 (gdb) cond 2 $3 != $4 (gdb) c
Side note: For a dancing bear - this is NOT what this issue is about - something like
section some-sec if oeit-custnum greater than custmas-ctr would be marvelous, but that's teaching GDB how COBOL works, so a separate
cbreak section and then
cond with previously seen expressions should be al we aim for now.