Closed nabice closed 2 years ago
Go version: 1.18.1
As the result below shows, new sz is incorrect. go run example console output:
start testing... foo1:23(miliao for foo1 before hook) hook done foo2:23(miliao for foo1 after hook) foo1:100(not calling foo3) r1:65, r2:4342 fake buffer WriteString func, s:hook by miliao value of buff:abcd:hook by miliao try hook bytes.Buffer.Len() calling myBuffLen calling myBuffLenTramp1 calling myBuffLenTramp2 calling myBuffLenTramp3 calling myBuffLenTramp4 old sz:19, new sz:19, copy func:19, recover:1233 fake buffer WriteString func, s:hook function at addr:4e3320, how:fix, num of instruction fixed:2 fake buffer WriteString func, s:==@004e3324 new inst: fake buffer WriteString func, s:0f fake buffer WriteString func, s:86 fake buffer WriteString func, s:9f fake buffer WriteString func, s:00 fake buffer WriteString func, s:00 fake buffer WriteString func, s:00 fake buffer WriteString func, s: fake buffer WriteString func, s:==@004e33ec new inst: fake buffer WriteString func, s:e9 fake buffer WriteString func, s:2f fake buffer WriteString func, s:ff fake buffer WriteString func, s:ff fake buffer WriteString func, s:ff fake buffer WriteString func, s: fake buffer WriteString func, s:hook function at addr:46c060, how:fix, num of instruction fixed:2 fake buffer WriteString func, s:==@0046c064 new inst: fake buffer WriteString func, s:0f fake buffer WriteString func, s:86 fake buffer WriteString func, s:dc fake buffer WriteString func, s:00 fake buffer WriteString func, s:00 fake buffer WriteString func, s:00 fake buffer WriteString func, s: fake buffer WriteString func, s:==@0046c169 new inst: fake buffer WriteString func, s:e9 fake buffer WriteString func, s:f2 fake buffer WriteString func, s:fe fake buffer WriteString func, s:ff fake buffer WriteString func, s:ff fake buffer WriteString func, s: debug info: hook function at addr:4e3320, how:fix, num of instruction fixed:2 ==@004e3324 new inst:0f 86 9f 00 00 00 ==@004e33ec new inst:e9 2f ff ff ff hook function at addr:46c060, how:fix, num of instruction fixed:2 ==@0046c064 new inst:0f 86 dc 00 00 00 ==@0046c169 new inst:e9 f2 fe ff ff
My bad. go build -gcflags=-l
Go version: 1.18.1
As the result below shows, new sz is incorrect. go run example console output: