.
authorclaus
Tue, 29 Aug 1995 00:45:44 +0200
changeset 114 ead0d3d79384
parent 113 51fc2cb14bae
child 115 38ab30a7046d
.
ObjFHandle.st
ObjFLoader.st
ObjectFileHandle.st
ObjectFileLoader.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjFHandle.st	Tue Aug 29 00:45:44 1995 +0200
@@ -0,0 +1,80 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      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.
+"
+
+Object subclass:#ObjectFileHandle
+       instanceVariableNames:'sysHandle1 sysHandle2 pathName id'
+       classVariableNames:''
+       poolDictionaries:''
+       category:'System-Compiler'
+!
+
+ObjectFileHandle comment:'
+COPYRIGHT (c) 1995 by Claus Gittinger
+	     All Rights Reserved
+
+$Header: /cvs/stx/stx/libcomp/Attic/ObjFHandle.st,v 1.1 1995-08-28 22:45:34 claus Exp $
+'!
+
+!ObjectFileHandle class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      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.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libcomp/Attic/ObjFHandle.st,v 1.1 1995-08-28 22:45:34 claus Exp $
+"
+!
+
+documentation
+"
+    A support class for the ObjectFileLoader
+    not for public use.
+"
+! !
+
+!ObjectFileHandle methodsFor:'accessing'!
+
+sysHandle1:h1 sysHandle2:h2 pathName:path id:i
+    sysHandle1 := h1.
+    sysHandle2 := h2.
+    pathName := path.
+    id := i
+!
+
+sysHandle1
+    ^ sysHandle1
+!
+
+sysHandle2
+    ^ sysHandle2
+!
+
+pathName
+    ^ pathName
+!
+
+id
+    ^ id
+! !
+
--- a/ObjFLoader.st	Mon Aug 28 01:25:19 1995 +0200
+++ b/ObjFLoader.st	Tue Aug 29 00:45:44 1995 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.38 1995-08-27 23:24:55 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.39 1995-08-28 22:45:44 claus Exp $
 '!
 
 !ObjectFileLoader class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.38 1995-08-27 23:24:55 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.39 1995-08-28 22:45:44 claus Exp $
 "
 !
 
@@ -237,7 +237,6 @@
     (os = 'sunos') ifTrue:[
 	(cpu = 'sparc') ifTrue:[ ^ true ]
     ].
-    (os = 'linux') ifTrue:[ ^ false ].
 
     'OBJFLOADER: dont know if we need sepId - assume no' errorPrintNL.
     ^ false
@@ -272,12 +271,6 @@
 	]
     ].
 "
-    (os = 'linux') ifTrue:[
-	^ ('ld -A ' , MySymbolTable , 
-	   ' -x -N ',
-	   ' -Ttext ' , (textAddr printStringRadix:16) , 
-	   ' -Tdata ' , (dataAddr printStringRadix:16) , ' ' , file)
-    ].
     self error:'do not know how to link absolute'
 !
 
@@ -297,10 +290,6 @@
 
 	]
     ].
-    (os = 'linux') ifTrue:[
-	^ ('ld -A ' , MySymbolTable , 
-	   ' -x -N -Ttext ' , (textAddr printStringRadix:16) , ' ' , file)
-    ].
     self error:'do not know how to link absolute'
 !
 
@@ -652,9 +641,15 @@
 	"try with added underscore"
 	symName := '__' , aClassName , '_Init'.
 	initAddr := self getFunction:symName from:handle.
+	initAddr isNil ifTrue:[
+	    "try with added period (AIX)"
+	    symName := '._' , aClassName , '_Init'.
+	    initAddr := self getFunction:symName from:handle.
+	]
     ].
 
     knownToBeOk := true.
+
     knownToBeOk ifFalse:[
 	Verbose ifTrue:[
 	    'looking for undefs ...' infoPrintNL.
@@ -1051,6 +1046,79 @@
     "
      ObjectFileLoader loadedObjectFiles
     "
+!
+
+pathNameFromID:id
+    "given an id, return the pathName, or nil for static modules"
+
+    |handle|
+
+    LoadedObjects notNil ifTrue:[
+	LoadedObjects keysAndValuesDo:[:name :handle |
+	    (handle at:4) == id ifTrue:[
+		^ handle at:3
+	    ]
+	].
+    ].
+    ^ nil
+
+    "
+     ObjectFileLoader pathNameFromID:1        
+    "
+
+    "Modified: 28.8.1995 / 18:08:28 / claus"
+!
+
+moduleInfo
+    "return a collection of moduleInfo entries"
+
+    |modules|
+
+    modules := IdentityDictionary new.
+    self allModulesDo:[:entry | 
+	|id name type libName subModuleName module dynamic infoRec pathName|
+
+	id := entry at:1.
+	subModuleName := entry at:2.
+	libName := entry at:4.
+	id > 0 ifTrue:[
+	    pathName := self pathNameFromID:id.
+	    dynamic := true.
+	    name := 'dynamic module ' , (pathName asFilename baseName).
+	] ifFalse:[
+	    dynamic := false.
+	    pathName := nil.
+	    libName isNil ifTrue:[
+		name := 'builtIn module ' , subModuleName
+	    ] ifFalse:[
+		name := 'builtIn classLib ' , libName
+	    ].
+	].
+	libName isNil ifTrue:[
+	    type := #classObject
+	] ifFalse:[
+	    type := #classLibrary
+	].
+	infoRec := modules at:id ifAbsent:nil.
+	infoRec notNil ifTrue:[
+	    (infoRec at:#classNames) add:subModuleName
+	] ifFalse:[
+	    infoRec := IdentityDictionary new.
+	    infoRec at:#id put:id.
+	    infoRec at:#classNames put:(Set with:subModuleName).
+	    infoRec at:#pathName put:pathName.
+	    infoRec at:#name put:name.
+	    infoRec at:#libraryName put:libName.
+	    infoRec at:#dynamic put:dynamic.
+	    infoRec at:#type put:type.
+	    modules at:id put:infoRec.
+	].
+    ].
+    ^ modules
+
+    "
+     ObjectFileLoader moduleInfo
+    "
 ! !
 
 !ObjectFileLoader class methodsFor:'dynamic object access'!
@@ -1344,7 +1412,9 @@
 
     |key|
 
-    'unload module name=' infoPrint. (handle at:3) infoPrintNL.
+    Verbose ifTrue:[
+        'unload module name=' infoPrint. (handle at:3) infoPrintNL.
+    ].
 
     self performModuleDeInit:handle.
 
@@ -1852,8 +1922,10 @@
 performModuleDeInit:handle
     |id|
 
-    'deInit module name=' infoPrint. (handle at:3) infoPrint.
-    ' id=' infoPrint. (handle at:4) infoPrintNL.
+    Verbose ifTrue:[
+        'deInit module name=' infoPrint. (handle at:3) infoPrint.
+        ' id=' infoPrint. (handle at:4) infoPrintNL.
+    ].
 
     id := handle at:4.
 %{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectFileHandle.st	Tue Aug 29 00:45:44 1995 +0200
@@ -0,0 +1,80 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      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.
+"
+
+Object subclass:#ObjectFileHandle
+       instanceVariableNames:'sysHandle1 sysHandle2 pathName id'
+       classVariableNames:''
+       poolDictionaries:''
+       category:'System-Compiler'
+!
+
+ObjectFileHandle comment:'
+COPYRIGHT (c) 1995 by Claus Gittinger
+	     All Rights Reserved
+
+$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.1 1995-08-28 22:45:34 claus Exp $
+'!
+
+!ObjectFileHandle class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+	      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.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.1 1995-08-28 22:45:34 claus Exp $
+"
+!
+
+documentation
+"
+    A support class for the ObjectFileLoader
+    not for public use.
+"
+! !
+
+!ObjectFileHandle methodsFor:'accessing'!
+
+sysHandle1:h1 sysHandle2:h2 pathName:path id:i
+    sysHandle1 := h1.
+    sysHandle2 := h2.
+    pathName := path.
+    id := i
+!
+
+sysHandle1
+    ^ sysHandle1
+!
+
+sysHandle2
+    ^ sysHandle2
+!
+
+pathName
+    ^ pathName
+!
+
+id
+    ^ id
+! !
+
--- a/ObjectFileLoader.st	Mon Aug 28 01:25:19 1995 +0200
+++ b/ObjectFileLoader.st	Tue Aug 29 00:45:44 1995 +0200
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.38 1995-08-27 23:24:55 claus Exp $
+$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.39 1995-08-28 22:45:44 claus Exp $
 '!
 
 !ObjectFileLoader class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.38 1995-08-27 23:24:55 claus Exp $
+$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.39 1995-08-28 22:45:44 claus Exp $
 "
 !
 
@@ -237,7 +237,6 @@
     (os = 'sunos') ifTrue:[
 	(cpu = 'sparc') ifTrue:[ ^ true ]
     ].
-    (os = 'linux') ifTrue:[ ^ false ].
 
     'OBJFLOADER: dont know if we need sepId - assume no' errorPrintNL.
     ^ false
@@ -272,12 +271,6 @@
 	]
     ].
 "
-    (os = 'linux') ifTrue:[
-	^ ('ld -A ' , MySymbolTable , 
-	   ' -x -N ',
-	   ' -Ttext ' , (textAddr printStringRadix:16) , 
-	   ' -Tdata ' , (dataAddr printStringRadix:16) , ' ' , file)
-    ].
     self error:'do not know how to link absolute'
 !
 
@@ -297,10 +290,6 @@
 
 	]
     ].
-    (os = 'linux') ifTrue:[
-	^ ('ld -A ' , MySymbolTable , 
-	   ' -x -N -Ttext ' , (textAddr printStringRadix:16) , ' ' , file)
-    ].
     self error:'do not know how to link absolute'
 !
 
@@ -652,9 +641,15 @@
 	"try with added underscore"
 	symName := '__' , aClassName , '_Init'.
 	initAddr := self getFunction:symName from:handle.
+	initAddr isNil ifTrue:[
+	    "try with added period (AIX)"
+	    symName := '._' , aClassName , '_Init'.
+	    initAddr := self getFunction:symName from:handle.
+	]
     ].
 
     knownToBeOk := true.
+
     knownToBeOk ifFalse:[
 	Verbose ifTrue:[
 	    'looking for undefs ...' infoPrintNL.
@@ -1051,6 +1046,79 @@
     "
      ObjectFileLoader loadedObjectFiles
     "
+!
+
+pathNameFromID:id
+    "given an id, return the pathName, or nil for static modules"
+
+    |handle|
+
+    LoadedObjects notNil ifTrue:[
+	LoadedObjects keysAndValuesDo:[:name :handle |
+	    (handle at:4) == id ifTrue:[
+		^ handle at:3
+	    ]
+	].
+    ].
+    ^ nil
+
+    "
+     ObjectFileLoader pathNameFromID:1        
+    "
+
+    "Modified: 28.8.1995 / 18:08:28 / claus"
+!
+
+moduleInfo
+    "return a collection of moduleInfo entries"
+
+    |modules|
+
+    modules := IdentityDictionary new.
+    self allModulesDo:[:entry | 
+	|id name type libName subModuleName module dynamic infoRec pathName|
+
+	id := entry at:1.
+	subModuleName := entry at:2.
+	libName := entry at:4.
+	id > 0 ifTrue:[
+	    pathName := self pathNameFromID:id.
+	    dynamic := true.
+	    name := 'dynamic module ' , (pathName asFilename baseName).
+	] ifFalse:[
+	    dynamic := false.
+	    pathName := nil.
+	    libName isNil ifTrue:[
+		name := 'builtIn module ' , subModuleName
+	    ] ifFalse:[
+		name := 'builtIn classLib ' , libName
+	    ].
+	].
+	libName isNil ifTrue:[
+	    type := #classObject
+	] ifFalse:[
+	    type := #classLibrary
+	].
+	infoRec := modules at:id ifAbsent:nil.
+	infoRec notNil ifTrue:[
+	    (infoRec at:#classNames) add:subModuleName
+	] ifFalse:[
+	    infoRec := IdentityDictionary new.
+	    infoRec at:#id put:id.
+	    infoRec at:#classNames put:(Set with:subModuleName).
+	    infoRec at:#pathName put:pathName.
+	    infoRec at:#name put:name.
+	    infoRec at:#libraryName put:libName.
+	    infoRec at:#dynamic put:dynamic.
+	    infoRec at:#type put:type.
+	    modules at:id put:infoRec.
+	].
+    ].
+    ^ modules
+
+    "
+     ObjectFileLoader moduleInfo
+    "
 ! !
 
 !ObjectFileLoader class methodsFor:'dynamic object access'!
@@ -1344,7 +1412,9 @@
 
     |key|
 
-    'unload module name=' infoPrint. (handle at:3) infoPrintNL.
+    Verbose ifTrue:[
+        'unload module name=' infoPrint. (handle at:3) infoPrintNL.
+    ].
 
     self performModuleDeInit:handle.
 
@@ -1852,8 +1922,10 @@
 performModuleDeInit:handle
     |id|
 
-    'deInit module name=' infoPrint. (handle at:3) infoPrint.
-    ' id=' infoPrint. (handle at:4) infoPrintNL.
+    Verbose ifTrue:[
+        'deInit module name=' infoPrint. (handle at:3) infoPrint.
+        ' id=' infoPrint. (handle at:4) infoPrintNL.
+    ].
 
     id := handle at:4.
 %{