Added VDBVirtualMemoryMap, a model for memory maps
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 13 Oct 2017 21:38:13 +0100
changeset 48 0076f0700e5e
parent 47 25d82943a3cf
child 49 2ec7f7ed9242
Added VDBVirtualMemoryMap, a model for memory maps
Make.proto
Make.spec
VDBFrameApplication.st
VDBVirtualMemoryMap.st
VDBVirtualMemoryRegion.st
abbrev.stc
bc.mak
jv_vdb.st
libInit.cc
--- a/Make.proto	Wed Sep 13 22:15:11 2017 +0100
+++ b/Make.proto	Fri Oct 13 21:38:13 2017 +0100
@@ -34,7 +34,7 @@
 # add the path(es) here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/jv/libgdbs -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2 -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libtool2 -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libwidg2
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/xml/vw -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic2 -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libtool2 -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libwidg2
 
 
 # if you need any additional defines for embedded C code,
@@ -129,6 +129,8 @@
 $(OUTDIR)VDBAbstractApplication.$(O) VDBAbstractApplication.$(C) VDBAbstractApplication.$(H): VDBAbstractApplication.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 $(OUTDIR)VDBIconLibrary.$(O) VDBIconLibrary.$(C) VDBIconLibrary.$(H): VDBIconLibrary.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)VDBModelPresenter.$(O) VDBModelPresenter.$(C) VDBModelPresenter.$(H): VDBModelPresenter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/AbstractHierarchicalItem.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
+$(OUTDIR)VDBVirtualMemoryMap.$(O) VDBVirtualMemoryMap.$(C) VDBVirtualMemoryMap.$(H): VDBVirtualMemoryMap.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)VDBVirtualMemoryRegion.$(O) VDBVirtualMemoryRegion.$(C) VDBVirtualMemoryRegion.$(H): VDBVirtualMemoryRegion.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)jv_vdb.$(O) jv_vdb.$(C) jv_vdb.$(H): jv_vdb.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
 $(OUTDIR)VDBAbstractConsoleApplication.$(O) VDBAbstractConsoleApplication.$(C) VDBAbstractConsoleApplication.$(H): VDBAbstractConsoleApplication.st $(INCLUDE_TOP)/jv/vdb/VDBAbstractApplication.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 $(OUTDIR)VDBAbstractContainer.$(O) VDBAbstractContainer.$(C) VDBAbstractContainer.$(H): VDBAbstractContainer.st $(INCLUDE_TOP)/jv/vdb/VDBAbstractApplication.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
--- a/Make.spec	Wed Sep 13 22:15:11 2017 +0100
+++ b/Make.spec	Fri Oct 13 21:38:13 2017 +0100
@@ -54,6 +54,8 @@
 	VDBAbstractApplication \
 	VDBIconLibrary \
 	VDBModelPresenter \
+	VDBVirtualMemoryMap \
+	VDBVirtualMemoryRegion \
 	jv_vdb \
 	VDBAbstractConsoleApplication \
 	VDBAbstractContainer \
@@ -82,6 +84,8 @@
     $(OUTDIR)VDBAbstractApplication.$(O) \
     $(OUTDIR)VDBIconLibrary.$(O) \
     $(OUTDIR)VDBModelPresenter.$(O) \
+    $(OUTDIR)VDBVirtualMemoryMap.$(O) \
+    $(OUTDIR)VDBVirtualMemoryRegion.$(O) \
     $(OUTDIR)jv_vdb.$(O) \
     $(OUTDIR)VDBAbstractConsoleApplication.$(O) \
     $(OUTDIR)VDBAbstractContainer.$(O) \
--- a/VDBFrameApplication.st	Wed Sep 13 22:15:11 2017 +0100
+++ b/VDBFrameApplication.st	Fri Oct 13 21:38:13 2017 +0100
@@ -9,6 +9,7 @@
 	category:'VDB-UI-Others'
 !
 
+
 !VDBFrameApplication class methodsFor:'accessing'!
 
 windowTitle
@@ -263,3 +264,10 @@
     "Modified: / 13-06-2017 / 14:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!VDBFrameApplication class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VDBVirtualMemoryMap.st	Fri Oct 13 21:38:13 2017 +0100
@@ -0,0 +1,56 @@
+"{ Package: 'jv:vdb' }"
+
+"{ NameSpace: Smalltalk }"
+
+Object subclass:#VDBVirtualMemoryMap
+	instanceVariableNames:'regions'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'VDB-Tools'
+!
+
+!VDBVirtualMemoryMap class methodsFor:'instance creation'!
+
+fromSysInternalsVmmapDump: aStringOrFilenameOrStream
+    | s |
+
+    s := aStringOrFilenameOrStream readStream.
+    ^ [
+        self new initializeFromSysInternalsVmmapDump: s
+    ] ensure:[ 
+        s close.
+    ].
+
+    "Created: / 13-10-2017 / 12:11:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVirtualMemoryMap methodsFor:'reading'!
+
+initializeFromSysInternalsVmmapDump: aStream
+    "
+    Initializes regions from SysInterna's vmmap.exe dump (.mmp)
+    "
+    | dump snapshot |
+
+    dump := XML::XMLParser parse: aStream.
+    snapshot := (dump / 'root' / 'Snapshots' / 'Snapshot') last.
+    regions := (snapshot / 'MemoryRegions' / 'Region') 
+                select:[ :node | 
+                    (node @ 'Commit') ~= '0'.
+                ]
+                thenCollect:[ :node |
+                    | region |
+
+                    region := VDBVirtualMemoryRegion new
+                                address:     (node @ 'Address') asInteger;
+                                size:        (node @ 'Size') asInteger;
+                                protection:  (node @ 'Protection') asInteger;
+                                comment:     (node @ 'Details');
+                                yourself.
+                ] as: OrderedCollection.
+
+    regions sort:[ :a :b | a address  < b address ].
+
+    "Created: / 13-10-2017 / 12:06:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VDBVirtualMemoryRegion.st	Fri Oct 13 21:38:13 2017 +0100
@@ -0,0 +1,67 @@
+"{ Package: 'jv:vdb' }"
+
+"{ NameSpace: Smalltalk }"
+
+Object subclass:#VDBVirtualMemoryRegion
+	instanceVariableNames:'address size protection comment'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'VDB-Tools'
+!
+
+!VDBVirtualMemoryRegion methodsFor:'accessing'!
+
+address
+    ^ address
+!
+
+address:something
+    address := something.
+!
+
+comment
+    ^ comment
+!
+
+comment:something
+    comment := something.
+!
+
+protection
+    ^ protection
+!
+
+protection:something
+    protection := something.
+!
+
+size
+    ^ size
+!
+
+size:something
+    size := something.
+! !
+
+!VDBVirtualMemoryRegion methodsFor:'printing & storing'!
+
+printOn:aStream
+    "append a printed representation of the receiver to the argument, aStream"
+
+    | end |
+
+    super printOn:aStream.
+    aStream nextPut: $(.
+
+    aStream nextPutAll: '0x'.
+    address printOn: aStream base: 16 size: ExternalAddress sizeOfPointer * 2 fill: $0.
+    end := address + size.
+    aStream nextPutAll: ' - 0x'.
+    end printOn: aStream base: 16 size: ExternalAddress sizeOfPointer * 2 fill: $0.
+
+
+    aStream nextPut: $).
+
+    "Modified: / 13-10-2017 / 12:34:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/abbrev.stc	Wed Sep 13 22:15:11 2017 +0100
+++ b/abbrev.stc	Fri Oct 13 21:38:13 2017 +0100
@@ -4,6 +4,8 @@
 VDBAbstractApplication VDBAbstractApplication jv:vdb 'VDB-UI-Abstract' 2
 VDBIconLibrary VDBIconLibrary jv:vdb 'VDB-UI-Support' 0
 VDBModelPresenter VDBModelPresenter jv:vdb 'VDB-Presentation' 0
+VDBVirtualMemoryMap VDBVirtualMemoryMap jv:vdb 'VDB-Tools' 0
+VDBVirtualMemoryRegion VDBVirtualMemoryRegion jv:vdb 'VDB-Tools' 0
 jv_vdb jv_vdb jv:vdb '* Projects & Packages *' 3
 VDBAbstractConsoleApplication VDBAbstractConsoleApplication jv:vdb 'VDB-UI-Console' 2
 VDBAbstractContainer VDBAbstractContainer jv:vdb 'VDB-UI-Abstract' 2
--- a/bc.mak	Wed Sep 13 22:15:11 2017 +0100
+++ b/bc.mak	Fri Oct 13 21:38:13 2017 +0100
@@ -35,7 +35,7 @@
 
 
 
-LOCALINCLUDES= -I$(INCLUDE_TOP)\jv\libgdbs -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic2 -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libtool2 -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libwidg2
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\xml\vw -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic2 -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libtool2 -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libwidg2
 LOCALDEFINES=
 
 STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES)  -varPrefix=$(LIBNAME)
@@ -76,6 +76,8 @@
 $(OUTDIR)VDBAbstractApplication.$(O) VDBAbstractApplication.$(C) VDBAbstractApplication.$(H): VDBAbstractApplication.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 $(OUTDIR)VDBIconLibrary.$(O) VDBIconLibrary.$(C) VDBIconLibrary.$(H): VDBIconLibrary.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)VDBModelPresenter.$(O) VDBModelPresenter.$(C) VDBModelPresenter.$(H): VDBModelPresenter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\AbstractHierarchicalItem.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
+$(OUTDIR)VDBVirtualMemoryMap.$(O) VDBVirtualMemoryMap.$(C) VDBVirtualMemoryMap.$(H): VDBVirtualMemoryMap.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)VDBVirtualMemoryRegion.$(O) VDBVirtualMemoryRegion.$(C) VDBVirtualMemoryRegion.$(H): VDBVirtualMemoryRegion.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)jv_vdb.$(O) jv_vdb.$(C) jv_vdb.$(H): jv_vdb.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
 $(OUTDIR)VDBAbstractConsoleApplication.$(O) VDBAbstractConsoleApplication.$(C) VDBAbstractConsoleApplication.$(H): VDBAbstractConsoleApplication.st $(INCLUDE_TOP)\jv\vdb\VDBAbstractApplication.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 $(OUTDIR)VDBAbstractContainer.$(O) VDBAbstractContainer.$(C) VDBAbstractContainer.$(H): VDBAbstractContainer.st $(INCLUDE_TOP)\jv\vdb\VDBAbstractApplication.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
--- a/jv_vdb.st	Wed Sep 13 22:15:11 2017 +0100
+++ b/jv_vdb.st	Fri Oct 13 21:38:13 2017 +0100
@@ -49,7 +49,7 @@
      Please also take a look at the #mandatoryPreRequisites method"
 
     ^ #(
-        #'jv:libgdbs'    "GDBBreakpointCreatedEvent - referenced by VDBBreakpointListApplication>>subscribe"
+        #'stx:goodies/xml/vw'    "XML::XMLParser - referenced by VDBVirtualMemoryMap>>initializeFromSysInternalsVmmapDump:"
         #'stx:libbasic2'    "List - referenced by VDBAbstractContainer>>initialize"
         #'stx:libtool'    "DebugView - referenced by VDBDebuggerApplication class>>initializeDefaultKeyboardMap"
         #'stx:libtool2'    "MenuEditor - referenced by VDBIconLibrary class>>initialize"
@@ -81,6 +81,8 @@
         VDBAbstractApplication
         VDBIconLibrary
         VDBModelPresenter
+        VDBVirtualMemoryMap
+        VDBVirtualMemoryRegion
         #'jv_vdb'
         VDBAbstractConsoleApplication
         VDBAbstractContainer
--- a/libInit.cc	Wed Sep 13 22:15:11 2017 +0100
+++ b/libInit.cc	Fri Oct 13 21:38:13 2017 +0100
@@ -19,6 +19,8 @@
 extern void _VDBAbstractApplication_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _VDBIconLibrary_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _VDBModelPresenter_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _VDBVirtualMemoryMap_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _VDBVirtualMemoryRegion_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _jv_137vdb_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _VDBAbstractConsoleApplication_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _VDBAbstractContainer_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -56,6 +58,8 @@
     _VDBAbstractApplication_Init(pass,__pRT__,snd);
     _VDBIconLibrary_Init(pass,__pRT__,snd);
     _VDBModelPresenter_Init(pass,__pRT__,snd);
+    _VDBVirtualMemoryMap_Init(pass,__pRT__,snd);
+    _VDBVirtualMemoryRegion_Init(pass,__pRT__,snd);
     _jv_137vdb_Init(pass,__pRT__,snd);
     _VDBAbstractConsoleApplication_Init(pass,__pRT__,snd);
     _VDBAbstractContainer_Init(pass,__pRT__,snd);