diff --git a/src/dbginfo/dbginfo.c b/src/dbginfo/dbginfo.c index 7b35224b0..f6a201ade 100644 --- a/src/dbginfo/dbginfo.c +++ b/src/dbginfo/dbginfo.c @@ -54,7 +54,7 @@ /* Version numbers of the debug format we understand */ #define VER_MAJOR 1U -#define VER_MINOR 0U +#define VER_MINOR 0U /* Dynamic strings */ typedef struct StrBuf StrBuf; @@ -1663,11 +1663,22 @@ static void ParseSegment (InputData* D) goto ErrorExit; } - /* Check for required information */ + /* Check for required and/or matched information */ if ((InfoBits & ibRequired) != ibRequired) { ParseError (D, CC65_ERROR, "Required attributes missing"); goto ErrorExit; } + InfoBits &= (ibOutputName | ibOutputOffs); + if (InfoBits != ibNone && InfoBits != (ibOutputName | ibOutputOffs)) { + ParseError (D, CC65_ERROR, + "Attributes \"outputname\" and \"outputoffs\" must be paired"); + goto ErrorExit; + } + + /* Fix OutputOffs if not given */ + if (InfoBits == ibNone) { + OutputOffs = 0; + } /* Create the segment info and remember it */ S = NewSegInfo (&SegName, Id, Start, Size, &OutputName, OutputOffs);