Skip to content

Commit d574f69

Browse files
authored
Fix crash DYLINK_DEBUG=2 (#25636)
Also, cleanup error message.
1 parent 1fab6e2 commit d574f69

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/lib/libdylink.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,11 @@ var LibraryDylink = {
234234
var existingEntry = GOT[symName] && GOT[symName].value != 0;
235235
if (replace || !existingEntry) {
236236
#if DYLINK_DEBUG == 2
237-
dbg(`updateGOT: before: ${symName} : ${GOT[symName].value}`);
237+
dbg(`updateGOT: before: ${symName} : ${GOT[symName]?.value}`);
238238
#endif
239239
var newValue;
240240
if (typeof value == 'function') {
241241
newValue = {{{ to64('addFunction(value)') }}};
242-
#if DYLINK_DEBUG == 2
243-
dbg(`updateGOT: FUNC: ${symName} : ${GOT[symName].value}`);
244-
#endif
245242
} else if (typeof value == {{{ POINTER_JS_TYPE }}}) {
246243
newValue = value;
247244
} else {
@@ -1254,9 +1251,9 @@ var LibraryDylink = {
12541251
return loadDynamicLibrary(filename, combinedFlags, localScope, handle)
12551252
} catch (e) {
12561253
#if ASSERTIONS
1257-
err(`Error in loading dynamic library ${filename}: ${e}`);
1254+
err(`error loading dynamic library ${filename}: ${e}`);
12581255
#endif
1259-
dlSetError(`Could not load dynamic lib: ${filename}\n${e}`);
1256+
dlSetError(`could not load dynamic lib: ${filename}\n${e}`);
12601257
return 0;
12611258
}
12621259
},

test/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,9 +3009,9 @@ def test_dlfcn_missing(self):
30093009
'''
30103010

30113011
if self.get_current_js_engine() == config.V8_ENGINE:
3012-
expected = "error: Could not load dynamic lib: libfoo.so\nError: Error reading file"
3012+
expected = "error: could not load dynamic lib: libfoo.so\nError: Error reading file"
30133013
else:
3014-
expected = "error: Could not load dynamic lib: libfoo.so\nError: ENOENT: no such file or directory"
3014+
expected = "error: could not load dynamic lib: libfoo.so\nError: ENOENT: no such file or directory"
30153015
self.do_run(src, expected)
30163016

30173017
@needs_dylink

0 commit comments

Comments
 (0)