author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 30 Oct 2018 20:04:25 +0000 | |
changeset 159 | 5a364902a0fa |
parent 126 | fb73b0af430b |
child 259 | 651864c2aa29 |
permissions | -rw-r--r-- |
97 | 1 |
" |
2 |
jv:libgdbs - GNU Debugger Interface Library |
|
3 |
Copyright (C) 2015-now Jan Vrany |
|
4 |
||
5 |
This library is free software; you can redistribute it and/or |
|
6 |
modify it under the terms of the GNU Lesser General Public |
|
7 |
License as published by the Free Software Foundation; either |
|
8 |
version 2.1 of the License. |
|
9 |
||
10 |
This library is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
Lesser General Public License for more details. |
|
14 |
||
15 |
You should have received a copy of the GNU Lesser General Public |
|
16 |
License along with this library; if not, write to the Free Software |
|
17 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
" |
|
19 |
"{ Package: 'jv:libgdbs' }" |
|
20 |
||
21 |
"{ NameSpace: Smalltalk }" |
|
22 |
||
23 |
GDBObject subclass:#GDBMemoryDump |
|
24 |
instanceVariableNames:'addr nr_bytes total_bytes next_row prev_row next_page prev_page |
|
25 |
memory' |
|
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
category:'GDB-Core' |
|
29 |
! |
|
30 |
||
31 |
!GDBMemoryDump class methodsFor:'documentation'! |
|
32 |
||
33 |
copyright |
|
34 |
" |
|
35 |
jv:libgdbs - GNU Debugger Interface Library |
|
36 |
Copyright (C) 2015-now Jan Vrany |
|
37 |
||
38 |
This library is free software; you can redistribute it and/or |
|
39 |
modify it under the terms of the GNU Lesser General Public |
|
40 |
License as published by the Free Software Foundation; either |
|
41 |
version 2.1 of the License. |
|
42 |
||
43 |
This library is distributed in the hope that it will be useful, |
|
44 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
45 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
46 |
Lesser General Public License for more details. |
|
47 |
||
48 |
You should have received a copy of the GNU Lesser General Public |
|
49 |
License along with this library; if not, write to the Free Software |
|
50 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
51 |
" |
|
52 |
! |
|
53 |
||
54 |
documentation |
|
55 |
" |
|
56 |
GDBMemoryDump object represents a memory dump as produced by |
|
57 |
`x` or `-data-read-memory` commands. |
|
58 |
||
59 |
[author:] |
|
60 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
61 |
||
62 |
[instance variables:] |
|
63 |
||
64 |
[class variables:] |
|
65 |
||
66 |
[see also:] |
|
67 |
GDBMI_data_read_memory |
|
68 |
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Data-Manipulation.html |
|
69 |
||
70 |
" |
|
71 |
! ! |
|
72 |
||
73 |
!GDBMemoryDump class methodsFor:'accessing-magritte'! |
|
74 |
||
75 |
description |
|
76 |
^ (super description) |
|
126
fb73b0af430b
Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
77 |
define:#addr as:String; |
97 | 78 |
define:#nr_bytes as:Integer; |
79 |
define:#total_bytes as:Integer; |
|
80 |
define:#memory as: Array of: GDBMemoryDumpRow; |
|
81 |
yourself |
|
82 |
||
83 |
"Created: / 25-01-2018 / 08:41:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
126
fb73b0af430b
Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
84 |
"Modified: / 03-07-2018 / 17:06:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
97 | 85 |
! ! |
86 |
||
87 |
!GDBMemoryDump methodsFor:'accessing'! |
|
88 |
||
89 |
addr |
|
90 |
^ addr |
|
91 |
! |
|
92 |
||
93 |
memory |
|
94 |
^ memory |
|
95 |
! ! |
|
96 |
||
97 |
!GDBMemoryDump methodsFor:'displaying'! |
|
98 |
||
99 |
displayOn: aStream |
|
100 |
| addrW colW | |
|
101 |
||
102 |
addrW := addr size. |
|
103 |
colW := memory inject: 0 into:[:w1 :r | r data inject: w1 into: [ :w2 :val | w2 max: val size ] ]. |
|
104 |
memory do:[:row| |
|
126
fb73b0af430b
Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
105 |
aStream nextPutAll: '0x'. |
fb73b0af430b
Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
106 |
row addr printOn: aStream base: 16 size: 16 fill: $0. |
fb73b0af430b
Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
107 |
aStream nextPut: $;; space. |
97 | 108 |
row data do:[:each | |
109 |
aStream nextPutAll: each; next: colW - each size + 2 put: Character space. |
|
110 |
]. |
|
111 |
row ascii notNil ifTrue:[ |
|
112 |
aStream space; nextPutAll: row ascii. |
|
113 |
]. |
|
114 |
aStream cr. |
|
115 |
]. |
|
116 |
||
117 |
"Created: / 25-01-2018 / 23:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
126
fb73b0af430b
Added initial support for disassembling
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
97
diff
changeset
|
118 |
"Modified: / 04-07-2018 / 14:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
97 | 119 |
! ! |
120 |
||
121 |
!GDBMemoryDump methodsFor:'inspecting'! |
|
122 |
||
123 |
inspector2TabCondition |
|
124 |
<inspector2Tab> |
|
125 |
||
126 |
^ Tools::Inspector2Tab new |
|
127 |
priority: 90; |
|
128 |
label:'Memory'; |
|
129 |
text: [ self displayString ] |
|
130 |
yourself. |
|
131 |
||
132 |
"Created: / 25-01-2018 / 23:16:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
133 |
! ! |
|
134 |