I'm a bit late to the party, but here goes...

Our Ada compiler has support for this, described in terms of arrays.
It's similar to the Pascal example that someone provided.  If the only
way to get a type like this in PL/I is with a bit string, then the
producer could still describe this as an array, and a debugger could
"just know" about the syntactic sugar, and describe the type as a bit
string.

The tricky piece in your case, and this differed from our Ada
implementation, is that the string length (a.k.a. array upper bound,
possibly +1) is at the beginning of the object.  So you'd need to use a
DW_AT_data_location to inform a debugger to skip past that to get to the
actual bits.

On 12/18/24 13:39, Thomas David Rivers via Dwarf-discuss wrote:
> David Blaikie wrote:
>> What sort of string-like behavior would one want on a bit-string? Seems
>> like array would be the better fit to me...
>>
>   It's a language that originates in the late 60s - so there are some,
>   "different" ideas than more contemporary languages.
>
>   You can ask for sub-strings of strings (character or bit), you can
>   assign a string (shorter or of equal length) to a target string,
>   you can also concatenate strings, and you can assign to portions
>   within a target bit string (or character string for that matter.)
>
>   e.g.
>
>      test: proc;
>
>       dcl b10 bit(10);
>       dcl b20 bit(20) varying;
>       dcl dest bit(30) varying4;  /* maximum possible result size */
>
>     b10 = '1010'b;  /* assigns '1010000000' to b10 (passing on the right */
>                     /* with 0 bits because the length is fixed. */
>
>     b20 = '10'b;    /* assigns '10' to b20, moving a byte containing  */
>                     /* '10......' and setting the 2-byte length field */
>                     /* to 2, indicating the left-most 2 bits are used. */
>
>     dest = b10 || b20;  /* assigns '101000000010....' to dest, setting it's */
>                         /* 4-byte length field to 12. */
>
>     b10 = substr(dest,1,2);  /* extracts the first 2 bits from the bitfield */
>                /* dest ('10') (2 bytes starting a position #1) and assigns  */
>                /* it to b10, which is extended to 10 bits on-the-right      */
>                /* because b10 is a fixed-length, resulting in '1000000000'  */
>                /* being assigned to b10 */
>
>     substr(b10,6,1) = '1'b;  /* assigns a 1-bit value to b10, starting */
>                              /* at bit #6 and going for 1 bit, resulting */
>                              /* in '1010010000' being in b10 */
>
>       end proc;
>
>   So - it's a rather abstract idea of "strings of bits" similar to
>   "strings of characters".
>
>       - Dave Rivers -
>
> --
> riv...@dignus.com
>
> --
> Dwarf-discuss mailing list
> Dwarf-discuss@lists.dwarfstd.org
> https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss


-- 
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss

Reply via email to