DISection.st
author Jan Vrany <jan.vrany@labware.com>
Thu, 27 Oct 2022 14:53:59 +0100
branchjv
changeset 4735 3b11fb3ede98
parent 4384 aee25576d864
permissions -rw-r--r--
Allow single underscore as method / block argument and temporaries This commit is a follow up for 38b221e.

"
 COPYRIGHT (c) 1989 by Claus Gittinger / eXept Software AG
 COPYRIGHT (c) 2016 Jan Vrany
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libcomp' }"

"{ NameSpace: Smalltalk }"

DIEntry subclass:#DISection
	instanceVariableNames:'type'
	classVariableNames:''
	poolDictionaries:'DISectionTypes'
	category:'System-Compiler-Debug Info'
!

!DISection class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1989 by Claus Gittinger / eXept Software AG
 COPYRIGHT (c) 2016 Jan Vrany
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!DISection class methodsFor:'reading'!

decode: aStreamOrByteArray
    | stream pos size type |

    stream := aStreamOrByteArray readStream.
    pos := stream position.
    size := stream nextUnsignedInt16MSB: UninterpretedBytes isBigEndian. 
    type := stream nextByte.
    stream position: pos.
    type == DbgInfoSectionVariableTable ifTrue:[ 
        ^ DIVariableTable new decode: stream
    ] ifFalse:[ 
        ^ DISection new decode: stream
    ].

    "Created: / 10-07-2018 / 12:46:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 15-07-2018 / 12:27:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!DISection methodsFor:'accessing'!

type
    ^ type
! !

!DISection methodsFor:'reading & writing'!

decode: aStream
    size := aStream nextUnsignedInt16MSB: UninterpretedBytes isBigEndian.
    type := aStream nextByte.     
    aStream skip: size - 2"sizeof(size)" - 1"sizeof(type)"

    "Created: / 10-07-2018 / 12:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 10-07-2018 / 14:49:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!DISection methodsFor:'testing'!

isVariableTableSection
    ^ false

    "Created: / 15-07-2018 / 11:27:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !