Issue 020118.1: Opcode_base Value

Author: Ron Brender
Champion: Ron Brender
Date submitted: 2002-01-18
Date revised:
Date closed:
Type: Editorial
Status: Accepted with modifications
DWARF Version: 3
Keith Walker wrote:
>DWARF3 Draft 7Section 6.2.4, Definition of opcode_base states the following:
>
>    8. opcode_base (ubyte)
>
>    The number assigned to the first special opcode.
>
>    This number may be larger or smaller than the number of standard
>    opcodes defined for the specified version of the line number
>    information (12 in DWARF V3, 9 in DWARF V2).  If smaller, then the
>    higher numbered opcodes are not used in the line number table
>    of this unit (and the codes are treated as special opcodes).  If
>    greater, then the numbers between that of the highest standard
>    opcode and the first special opcode (not inclusive) are necessarily
>    code for vendor extensions.
>
>It appears to me that the description in the 2nd paragraph suffers from an
>"off by one" error in that the field contains the number assigned to the
>first special opcode and not the number of standard (+ user defined)
>opcodes in use.

Yes, Keith is entirely correct.

Perhaps the simplest repair is to change the latter paragraph to read

    This number may be larger or smaller than the number of standard
    opcodes defined for the specified version of the line number
    information plus one, that is, larger or smaller than 13 in
    DWARF V3 or 10 in DWARF V2.  If smaller, then the ...

The grammar is a touch awkward, but I think clear and unambiguous.

=====================================================================
5/17/2004:  Accepted with modifications:
 8. opcode_base (ubyte) 
    The number assigned to the first special opcode.

    *This number is typically the next higher number after the  number    |
    of standard opcodes defined for the specified version of the line
    number information (12 in DWARF Version 3, 9 in DWARF Version 2).
    If smaller, then the higher numbered standard  opcodes are not      |
    used in the line number table of this unit (and the codes are
    treated as special opcodes). If greater, then the numbers between
    that of the highest standard opcode and the first special opcode
    (not inclusive) are used for vendor specific extensions.            |*