Announcement

Collapse
No announcement yet.

Debugger Shows Wrong Content With Char(1024) Fields in RPG

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scholli2000
    replied
    Thank you a lot for your efforts :-)

    That’s strange, because the behavior occurs also on my colleague’s PC and with different versions of RDi.

    To avoid any misunderstanding: This is only about how the RDi debugger displays the field contents.
    So to me it is quite clear that inz won’t change anything.

    Click image for larger version  Name:	2021-09-29 15_26_07-workspace - Debug - RemoteSystemsTempFiles_192.168.50.1_QSYS.LIB_IHDNETT.LIB_QRP.png Views:	0 Size:	11.8 KB ID:	156137

    The programs runs well and if I output the variables in a table the field is all *blanks like you would expect.

    @Scott: I first run into it in a service program and it took me an hour to realize that the debugger was wrong - not my program. I wrote the test program to exclude side effects. I haved also checked it on our second machine.

    In the Memory Monitor View, you see the whole field is x'40'. So I guess, it must be an RDi problem. (Mine is running on Windows 8.1)

    Click image for larger version

Name:	2021-09-29 15_44_15-workspace - Debug - RemoteSystemsTempFiles_192.168.50.11_QSYS.LIB_IHDNETT.LIB_QR.png
Views:	26
Size:	60.5 KB
ID:	156138

    Best,
    Markus
    Last edited by Scholli2000; September 29, 2021, 07:49 AM.

    Leave a comment:


  • Scott Klement
    replied
    Originally posted by Ghost + View Post
    Best practice is to initalize your variables. That should stop the dirty data you see here.
    That would be true in a C program, but not RPG. RPG always initializes every variable. If you wanted it initialized to something else besides blanks, then yes -- you'd need an INZ, but without the INZ RPG will always initialize it to blanks, so there is no reason to code the INZ.


    Originally posted by Scholli2000 View Post
    Even if I assign a value to the variable, a wrong value will be shown in the debugger.
    To me, it is an RDi problem. As I wrote, the problem doesn’t occur with a data type of char(1000)--or even char(1023).
    The program runs fine, the real content of the variables is *blanks. Not their actual content is shown in the debugger.

    In the following program, chrDummy1024 and chrDummy1024inz both are displayed with wrong content, while chrDummy1023, chrDummy1025 and chrDummy2048 are displayed correctly (in the latter case at least the first 1024 bytes are displayed correctly).
    I was not able to reproduce this problem. But, it sounds like you're experiencing memory corruption of some sort -- i.e. another routine has a bug that it is overwriting memory that it shouldn't be overwriting. This happens a lot with parameters, but you don't have any parameters defined in the code you posted.

    To test: Make sure you start a fresh job and ONLY run the above code (no other programs in the job.) Do you still get the problem?

    Also, try it in a different debugger, such as the green-screen STRDBG. Same problem?

    Leave a comment:


  • Ghost +
    replied
    Originally posted by Scholli2000 View Post
    Thank you, but did you test it?
    I sure did. Ran it again today and mine are all still blanks with and without the inz. I imagine it's happening because of an overlay of memory, thus suggesting the inz.

    I'm on RDI Version: 9.6.0.10 20210202_0642

    Leave a comment:


  • Scholli2000
    replied
    Thank you, but did you test it?

    Even if I assign a value to the variable, a wrong value will be shown in the debugger.
    To me, it is an RDi problem. As I wrote, the problem doesn’t occur with a data type of char(1000)--or even char(1023).
    The program runs fine, the real content of the variables is *blanks. Not their actual content is shown in the debugger.

    In the following program, chrDummy1024 and chrDummy1024inz both are displayed with wrong content, while chrDummy1023, chrDummy1025 and chrDummy2048 are displayed correctly (in the latter case at least the first 1024 bytes are displayed correctly).

    Code:
    **FREE
    ctl-opt main(atest1);
    
    dcl-proc atest1;
    
    // ----------------------------------------------------------------------------------
    // Procedure Interface
    // ----------------------------------------------------------------------------------
    dcl-pi atest1;
    end-pi;
    
    dcl-s chrDummy1023 char(1023);
    dcl-s chrDummy1024 char(1024);
    dcl-s chrDummy1024inz char(1024)inz;
    dcl-s chrDummy1025 char(1025);
    dcl-s chrDummy2048 char(2048);
    
    end-proc atest1;
    Edit: Problem occurs also with RDi 9.5.1.2
    Last edited by Scholli2000; September 29, 2021, 01:28 AM.

    Leave a comment:


  • Ghost +
    replied
    Best practice is to initalize your variables. That should stop the dirty data you see here.

    dcl-s chrDummy char(1024) inz;

    Leave a comment:


  • Scholli2000
    started a topic Debugger Shows Wrong Content With Char(1024) Fields in RPG

    Debugger Shows Wrong Content With Char(1024) Fields in RPG

    Hi all,

    when debugging RPG, the RDi debugger seems to not show the actual memory when debugging char(1024) fields.
    Changing the field to char(1000) makes the error disappear.

    Click image for larger version

Name:	2021-09-28 17_36_27-workspace - Debug - RemoteSystemsTempFiles_192.168.50.1_QSYS.LIB_IHDNETT.LIB_QRP.png
Views:	69
Size:	4.9 KB
ID:	156130

    I’m on Version: 9.6.0.10.

    Can someone reproduce this? I could by creating this program.
    Code:
    **free
    ctl-opt main(atest1);
    
    dcl-proc atest1;
    
    // ----------------------------------------------------------------------------------
    //                                       Main
    // ----------------------------------------------------------------------------------
    dcl-pi atest1;
    end-pi;
    
    dcl-s chrDummy char(1024);
    
    end-proc atest1;
    Last edited by Scholli2000; September 28, 2021, 09:42 AM.
Working...
X