2016-05-30 08:55:32 +00:00
|
|
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-09-28 13:50:56 +00:00
|
|
|
import {
|
2021-06-01 18:13:48 +00:00
|
|
|
CppProcessor, LinuxCppEntriesProvider
|
2020-09-28 13:50:56 +00:00
|
|
|
} from "../../../tools/dumpcpp.mjs" ;
|
2016-05-30 08:55:32 +00:00
|
|
|
|
2021-06-30 11:17:33 +00:00
|
|
|
await (async function testProcessSharedLibrary() {
|
2021-06-01 18:13:48 +00:00
|
|
|
var oldLoadSymbols = LinuxCppEntriesProvider.prototype.loadSymbols;
|
2016-05-30 08:55:32 +00:00
|
|
|
|
2021-06-01 18:13:48 +00:00
|
|
|
LinuxCppEntriesProvider.prototype.loadSymbols = function(libName) {
|
2016-05-30 08:55:32 +00:00
|
|
|
this.symbols = [[
|
|
|
|
'00000100 00000001 t v8::internal::Runtime_StringReplaceRegExpWithString(v8::internal::Arguments)',
|
|
|
|
'00000110 00000001 T v8::internal::Runtime::GetElementOrCharAt(v8::internal::Handle<v8::internal::Object>, unsigned int)',
|
|
|
|
'00000120 00000001 t v8::internal::Runtime_DebugGetPropertyDetails(v8::internal::Arguments)',
|
|
|
|
'00000130 00000001 W v8::internal::RegExpMacroAssembler::CheckPosition(int, v8::internal::Label*)'
|
|
|
|
].join('\n'), ''];
|
|
|
|
};
|
|
|
|
|
2021-06-01 18:13:48 +00:00
|
|
|
var testCppProcessor = new CppProcessor(new LinuxCppEntriesProvider(),
|
2016-05-30 08:55:32 +00:00
|
|
|
false, false);
|
2021-06-30 11:17:33 +00:00
|
|
|
await testCppProcessor.processSharedLibrary(
|
2016-05-30 08:55:32 +00:00
|
|
|
'/usr/local/google/home/lpy/v8/out/native/d8',
|
|
|
|
0x00000100, 0x00000400, 0);
|
|
|
|
|
|
|
|
var staticEntries = testCppProcessor.codeMap_.getAllStaticEntriesWithAddresses();
|
|
|
|
var total = staticEntries.length;
|
|
|
|
assertEquals(total, 3);
|
|
|
|
assertEquals(staticEntries[0],
|
|
|
|
[288,{size:1,
|
|
|
|
name:'v8::internal::Runtime_DebugGetPropertyDetails(v8::internal::Arguments)',
|
|
|
|
type:'CPP',
|
2020-11-30 10:53:12 +00:00
|
|
|
nameUpdated_:false,
|
|
|
|
source: undefined,
|
|
|
|
}
|
2016-05-30 08:55:32 +00:00
|
|
|
]);
|
|
|
|
assertEquals(staticEntries[1],
|
|
|
|
[272,{size:1,
|
|
|
|
name:'v8::internal::Runtime::GetElementOrCharAt(v8::internal::Handle<v8::internal::Object>, unsigned int)',
|
|
|
|
type:'CPP',
|
2020-11-30 10:53:12 +00:00
|
|
|
nameUpdated_:false,
|
|
|
|
source: undefined,
|
|
|
|
}
|
2016-05-30 08:55:32 +00:00
|
|
|
]);
|
|
|
|
assertEquals(staticEntries[2],
|
|
|
|
[256,{size:1,
|
|
|
|
name:'v8::internal::Runtime_StringReplaceRegExpWithString(v8::internal::Arguments)',
|
|
|
|
type:'CPP',
|
2020-11-30 10:53:12 +00:00
|
|
|
nameUpdated_:false,
|
|
|
|
source: undefined,
|
|
|
|
}
|
2016-05-30 08:55:32 +00:00
|
|
|
]);
|
|
|
|
|
2021-06-01 18:13:48 +00:00
|
|
|
LinuxCppEntriesProvider.prototype.loadSymbols = oldLoadSymbols;
|
2016-05-30 08:55:32 +00:00
|
|
|
})();
|