Eliot Miranda uploaded a new version of Cog to project VM Maker: http://source.squeak.org/VMMaker/Cog-eem.358.mcz ==================== Summary ==================== Name: Cog-eem.358 Author: eem Time: 15 November 2019, 3:08:45.366914 pm UUID: f25a45f3-ebe7-445c-8af2-146e242d26b1 Ancestors: Cog-eem.357 Fix a slip in x86-64 disassembly decoration. Misplaced closing bracket. =============== Diff against Cog-eem.357 =============== Item was changed: ----- Method: BochsX64Alien>>decorateDisassembly:for:fromAddress: (in category 'disassembly') ----- decorateDisassembly: anInstructionString for: aSymbolManager "<Cogit>" fromAddress: address | string i1 i2 v o extra | string := PrintCodeBytes ifTrue: [anInstructionString] ifFalse: [anInstructionString copyFrom: 1 to: (anInstructionString lastIndexOf: $:) - 1]. "trailing space useful for parsing numbers" aSymbolManager relativeBaseForDisassemblyInto: [:baseAddress :baseName| string := baseName, '+', (address - baseAddress printStringBase: 16 length: 4 padded: true), (string copyFrom: (string indexOf: $:) + 1 to: string size)]. ((i1 := string indexOfSubCollection: '%ds:(') > 0 or: [(i1 := string indexOfSubCollection: '%ss:(') > 0]) ifTrue: [string := string copyReplaceFrom: i1 to: i1 + 3 with: '']. (i1 := string indexOfSubCollection: '%ds:0x') > 0 ifTrue: [i2 := i1 + 6. ['0123456789abcdef' includes: (string at: i2)] whileTrue: [i2 := i2 + 1]. (v := string copyFrom: i2 to: (i2 + 5 min: string size)) = '(%rbx)' ifTrue: [o := Integer readFrom: (ReadStream on: string from: i1 + 6 to: i2 - 1) base: 16. (aSymbolManager lookupAddress: aSymbolManager varBaseAddress + o) ifNotNil: [:varName| extra := ' = ', varName]]. v = '(%rip)' ifTrue: [o := anInstructionString size - (anInstructionString lastIndexOf: $:) - 1 / 3. "Count number of instruction bytes to find size of instruction" o := o + address. "Add address of instruction" o := o + (Integer readFrom: (ReadStream on: string from: i1 + 6 to: i2 - 1) base: 16) signedIntFromLong64. "Add offset to yield pc-relative address" (aSymbolManager lookupAddress: o) ifNotNil: [:methodName| extra := ' = ', methodName]]. v = ReceiverResultRegDereference ifTrue: [o := Integer readFrom: (ReadStream on: string from: i1 + 6 to: i2 - 1) base: 16. (aSymbolManager lookupInstVarOffset: o) ifNotNil: [:varName| string := string copyReplaceFrom: i1 to: i2 - 1 with: varName,'@',o printString. i2 := 0]]. i2 ~= 0 ifTrue: [string := string copyReplaceFrom: i1 to: i2 - 1 with: (aSymbolManager lookupCHexString: (string copyFrom: i1 + 4 to: i2 - 1))]]. (i1 := string indexOfSubCollection: '%ss:0x') > 0 ifTrue: [i2 := i1 + 6. ['0123456789abcdef' includes: (string at: i2)] whileTrue: [i2 := i2 + 1]. ((string at: i2) = $( and: [(string at: i2 + 1) = $%]) ifTrue: [o := Integer readFrom: (ReadStream on: string from: i1 + 6 to: i2 - 1) base: 16. o := (o bitAnd: (1 bitShift: 31) - 1) - (o bitAnd: (1 bitShift: 31)). ((string copyFrom: i2 to: (i2 + 5 min: string size)) = '(%rbp)' and: [PrintTempNames]) ifTrue: [(aSymbolManager lookupFrameOffset: o) ifNotNil: + [:varName| string := string copyReplaceFrom: i1 to: i2 - 1 with: varName,'@',o printString. i2 := 0]]. + i2 ~= 0 ifTrue: [string := string copyReplaceFrom: i1 to: i2 - 1 with: o printString]]]. - [:varName| string := string copyReplaceFrom: i1 to: i2 - 1 with: varName,'@',o printString. i2 := 0]. - i2 ~= 0 ifTrue: [string := string copyReplaceFrom: i1 to: i2 - 1 with: o printString]]]]. (i1 := string indexOfSubCollection: '$0x') > 0 ifTrue: [i2 := i1 + 3. ['0123456789abcdef' includes: (string at: i2)] whileTrue: [i2 := i2 + 1]. string := string copyReplaceFrom: i1 + 1 to: i2 - 1 with: (aSymbolManager lookupCHexString: (string copyFrom: i1 + 1 to: i2 - 1))]. ((i1 := string indexOf: $() > 1 and: [(string at: i1 + 1) isDigit and: [i1 < (i2 := string indexOf: $))]]) ifTrue: [string := string copyReplaceFrom: i1 + 1 to: i2 - 1 with: (aSymbolManager lookupCHexString: (string copyFrom: i1 + 1 to: i2 - 1)). i1 := string indexOfSubCollection: '+0x'. "calls & jumps" i1 > 0 ifTrue: [o := Integer readFrom: (i2 := ReadStream on: string from: i1 + 3 to: string size) base: 16. o := ((o bitAnd: (1 bitShift: 63) - 1) - (o bitAnd: (1 bitShift: 63))) printStringRadix: 16. o := o first = $1 ifTrue: [o copyReplaceFrom: 1 to: 3 with: '+0x'] ifFalse: [o copyReplaceFrom: 2 to: 4 with: '0x']. string := string copyReplaceFrom: i1 to: i2 position with: o]]. ^extra ifNil: [string] ifNotNil: [PrintCodeBytes ifTrue: [i1 := string lastIndexOf: $:. string copyReplaceFrom: i1 - 1 to: i1 - 2 with: extra] ifFalse: [string, ';', extra]]! |
Free forum by Nabble | Edit this page |