Re: Debugging C program strings with STRDBG
Stephen West via C400-L <[email protected]> Wed, 3 Sep 2025 20:48:47 +0000
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <BL3PR13MB5108B3BB3E2281393A42ED64E401A@BL3PR13MB5108.namprd13.prod.outlook.com> |
There are syntax differences in a STRDBG session of a C or C++ program. On the 'eval' statement of your session, try the following statement: EVAL **dataarea:c 30 This will work if dataarea is a pointer. The ** dereferences the pointer to get at the memory it points to. The :c tells is to display the memory as a character. (Try :x for hex as an alternative) Tip: Characters in C/C++ are null terminated. They will end with x'00', so the :x way of viewing the data lets you see the null terminators. The 30 is just the number of characters in memory that you want to display. Nothing magical to 30. If dataarea is a pointer to an array, try the following syntax: EVAL *dataarea[1]:c 50 The [1] indicates that I want to view the 2nd array element (arrays start with zero in C/C++). Stephen West Lead Software Engineer [email protected]<mailto:[email protected]> From: C400-L <[email protected]> On Behalf Of Patrik Schindler Sent: Wednesday, September 3, 2025 2:39 PM To: Bare Metal Programming IBM i (AS/400 and iSeries) <[email protected]> Subject: [C400-L] Debugging C program strings with STRDBG Hello, some days ago, I finally found an easy entry into using the interactive debugger for debugging an RPG program. Now I try to debug a C program. So I place the cursor on a char variable and all I get is e. g.: dataarea = SPP:F441AE89590011B0 I presume SPP is for Space Pointer? Is there an easy way to retrieve that string within the debugger? Thanks! Please note: I'm doing this on stone age V4R5. :-) :wq! PoC -- This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: [email protected]<mailto:[email protected]> To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/c400-l<https://lists.midrange.com/mailman/listinfo/c400-l> or email: [email protected]<mailto:[email protected]> Before posting, please take a moment to review the archives at https://archive.midrange.com/c400-l<https://archive.midrange.com/c400-l>. -- This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/c400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/c400-l.