GDBOutputFormats.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 26 Mar 2021 15:07:02 +0000
changeset 224 34a835fad1c8
child 259 651864c2aa29
permissions -rw-r--r--
Introduce new pool `GDBOutputFormats` ...and move individual format instances there. For backward compatibility, accessor methods are kept in `GDBOutputFormat` (note the missing `s`!)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
224
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     1
"{ Encoding: utf8 }"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     2
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     3
"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     4
COPYRIGHT (c) 2021 LabWare
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     5
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     6
jv:libgdbs - GNU Debugger Interface Library
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     7
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     8
This library is free software; you can redistribute it and/or
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
     9
modify it under the terms of the GNU Lesser General Public
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    10
License as published by the Free Software Foundation; either
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    11
version 2.1 of the License. 
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    12
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    13
This library is distributed in the hope that it will be useful,
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    14
but WITHOUT ANY WARRANTY; without even the implied warranty of
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    16
Lesser General Public License for more details.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    17
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    18
You should have received a copy of the GNU Lesser General Public
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    19
License along with this library; if not, write to the Free Software
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    21
"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    22
"{ Package: 'jv:libgdbs' }"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    23
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    24
"{ NameSpace: Smalltalk }"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    25
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    26
SharedPool subclass:#GDBOutputFormats
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    27
	instanceVariableNames:''
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    28
	classVariableNames:'FormatAddress FormatBinary FormatCharacterConstant
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    29
		FormatFloatingPoint FormatHexadecimal FormatOctal
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    30
		FormatPaddedHexadecimal FormatRaw FormatSignedDecimal
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    31
		FormatString FormatUnsignedDecimal'
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    32
	poolDictionaries:''
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    33
	category:'GDB-Core'
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    34
!
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    35
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    36
!GDBOutputFormats class methodsFor:'documentation'!
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    37
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    38
copyright
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    39
"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    40
COPYRIGHT (c) 2021 LabWare
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    41
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    42
jv:libgdbs - GNU Debugger Interface Library
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    43
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    44
This library is free software; you can redistribute it and/or
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    45
modify it under the terms of the GNU Lesser General Public
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    46
License as published by the Free Software Foundation; either
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    47
version 2.1 of the License. 
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    48
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    49
This library is distributed in the hope that it will be useful,
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    50
but WITHOUT ANY WARRANTY; without even the implied warranty of
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    51
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    52
Lesser General Public License for more details.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    53
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    54
You should have received a copy of the GNU Lesser General Public
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    55
License along with this library; if not, write to the Free Software
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    56
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    57
"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    58
! !
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    59
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    60
!GDBOutputFormats class methodsFor:'initialization'!
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    61
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    62
initialize
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    63
    "Invoked at system start or when the class is dynamically loaded."
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    64
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    65
    "/ Following hack is here to allow loading from source and from compiled class lib.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    66
    "/ When loading from source, this is executed before GDBOutputFormat
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    67
    "/ class is loaded so we have to defer initialization and call it
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    68
    "/ from `GDBOutputFormat >> #initialize`
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    69
    (Smalltalk at: #GDBOutputFormat) isNil ifTrue: [ ^ self ].
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    70
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    71
    "/ See https://sourceware.org/gdb/onlinedocs/gdb/Output-Formats.html#Output-Formats
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    72
    FormatHexadecimal := GDBOutputFormat format: $x name: 'Hexadecimal' description: 'Regard the bits of the value as an integer, and print the integer in hexadecimal.'.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    73
    FormatSignedDecimal := GDBOutputFormat format: $d name: 'Signed decimal' description: 'Print as integer in signed decimal.'.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    74
    FormatUnsignedDecimal := GDBOutputFormat format: $u name: 'Unsigned decimal' description: 'Print as integer in unsigned decimal.'.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    75
    FormatOctal := GDBOutputFormat format: $o name: 'Octal' description: 'Print as integer in octal.'.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    76
    FormatBinary := GDBOutputFormat format: $t name: 'Binary' description: 'Print as integer in binary.'.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    77
    FormatAddress := GDBOutputFormat format: $a name: 'Address' description: 'Print as an address, both absolute in hexadecimal and as an offset from the nearest preceding symbol. You can use this format used to discover where (in what function) an unknown address is located:
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    78
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    79
(gdb) p/a 0x54320
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    80
$3 = 0x54320 <_initialize_vx+396>
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    81
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    82
The command info symbol 0x54320 yields similar results. See info symbol. '.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    83
    FormatCharacterConstant := GDBOutputFormat format: $c name: 'Character constant' description: '    Regard as an integer and print it as a character constant. This prints both the numerical value and its character representation. The character representation is replaced with the octal escape ‘\nnn’ for characters outside the 7-bit ASCII range.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    84
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    85
    Without this format, GDB displays char, unsigned char, and signed char data as character constants. Single-byte members of vectors are displayed as integer data.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    86
'.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    87
    FormatFloatingPoint := GDBOutputFormat format: $f name: 'Floating point' description: 'Regard the bits of the value as a floating point number and print using typical floating point syntax. '.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    88
    FormatString := GDBOutputFormat format: $s name: 'String' description: 'Regard as a string, if possible. With this format, pointers to single-byte data are displayed as null-terminated strings and arrays of single-byte data are displayed as fixed-length strings. Other values are displayed in their natural types.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    89
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    90
Without this format, GDB displays pointers to and arrays of char, unsigned char, and signed char as strings. Single-byte members of a vector are displayed as an integer array. '.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    91
    FormatPaddedHexadecimal := GDBOutputFormat format: $x name: 'Padded hexadecimal' description: 'Like ‘x’ (hexadecimal) formatting, the value is treated as an integer and printed as hexadecimal, but leading zeros are printed to pad the value to the size of the integer type. '.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    92
    FormatRaw := GDBOutputFormat format: $r name: 'Raw' description: 'Print using the ‘raw’ formatting. By default, GDB will use a Python-based pretty-printer, if one is available (see Pretty Printing). This typically results in a higher-level display of the value’s contents. The ‘r’ format bypasses any Python pretty-printer which might exist. '.
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    93
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    94
    "Modified: / 25-01-2018 / 09:29:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    95
    "Modified (comment): / 26-03-2021 / 13:27:42 / Jan Vrany <jan.vrany@labware.com>"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    96
! !
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    97
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    98
!GDBOutputFormats class methodsFor:'accessing'!
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
    99
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   100
all
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   101
    ^ self classVariableNames collect:[:name | self classVarAt: name ]
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   102
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   103
    "Created: / 26-01-2018 / 00:45:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   104
    "Modified: / 04-11-2020 / 10:49:00 / Jan Vrany <jan.vrany@labware.com>"
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   105
! !
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   106
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   107
!GDBOutputFormats class methodsFor:'documentation'!
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   108
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   109
version_HG
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   110
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   111
    ^ '$Changeset: <not expanded> $'
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   112
! !
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   113
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   114
34a835fad1c8 Introduce new pool `GDBOutputFormats`
Jan Vrany <jan.vrany@labware.com>
parents:
diff changeset
   115
GDBOutputFormats initialize!