Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging/debugging related to dynamic linking/pthreads. NFC #19446

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/library_dylink.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,14 @@ var LibraryDylink = {
loadedLibsByName: {},
// handle -> dso; Used by dlsym
loadedLibsByHandle: {},
init: () => newDSO('__main__', {{{ cDefs.RTLD_DEFAULT }}}, wasmImports),
init: () => {
#if ASSERTIONS
// This function needs to run after the initial wasmImports object
// as been created.
assert(wasmImports);
#endif
newDSO('__main__', {{{ cDefs.RTLD_DEFAULT }}}, wasmImports);
},
},

$dlSetError__internal: true,
Expand Down Expand Up @@ -1040,9 +1047,6 @@ var LibraryDylink = {
$loadDylibs__internal: true,
$loadDylibs__deps: ['$loadDynamicLibrary', '$reportUndefinedSymbols'],
$loadDylibs: function() {
#if DYLINK_DEBUG
dbg(`loadDylibs: ${dynamicLibraries}`);
#endif
if (!dynamicLibraries.length) {
#if DYLINK_DEBUG
dbg('loadDylibs: no libraries to preload');
Expand All @@ -1051,6 +1055,10 @@ var LibraryDylink = {
return;
}

#if DYLINK_DEBUG
dbg(`loadDylibs: ${dynamicLibraries}`);
#endif

// Load binaries asynchronously
addRunDependency('loadDylibs');
dynamicLibraries.reduce((chain, lib) => {
Expand Down
2 changes: 1 addition & 1 deletion src/parseTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ function makeRemovedModuleAPIAssert(moduleName, localName) {
function checkReceiving(name) {
// ALL_INCOMING_MODULE_JS_API contains all valid incoming module API symbols
// so calling makeModuleReceive* with a symbol not in this list is an error
assert(ALL_INCOMING_MODULE_JS_API.has(name));
assert(ALL_INCOMING_MODULE_JS_API.has(name), `${name} is not part of INCOMING_MODULE_JS_API`);
}

// Make code to receive a value on the incoming Module object.
Expand Down
2 changes: 1 addition & 1 deletion src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var out = () => { throw 'out() is not defined in worker.js.'; }
#endif
var err = threadPrintErr;
self.alert = threadAlert;
#if RUNTIME_DEBUG
#if ASSERTIONS || RUNTIME_DEBUG
var dbg = threadPrintErr;
#endif

Expand Down
3 changes: 2 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,8 @@ def test_undefined_symbols(self, action):
print('checking "%s" %s' % (args, value))
extra = ['-s', action + '_ON_UNDEFINED_SYMBOLS=%d' % value] if action else []
proc = self.run_process([EMXX, '-sUSE_SDL', 'main.cpp'] + extra + args, stderr=PIPE, check=False)
print(proc.stderr)
if common.EMTEST_VERBOSE:
print(proc.stderr)
if value or action is None:
# The default is that we error in undefined symbols
self.assertContained('undefined symbol: something', proc.stderr)
Expand Down