Skip to content

Commit d04fd3b

Browse files
authored
Fix pthread dbg wrapper when passed object (#24170)
Without this change we see `done init [object Object]`.
1 parent cadac51 commit d04fd3b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/lib/libpthread.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ var LibraryPThread = {
9696
) {
9797
t = _pthread_self();
9898
}
99-
return `w:${workerID},t:${ptrToString(t)}: `;
99+
return `w:${workerID},t:${ptrToString(t)}:`;
100100
}
101101

102102
// Prefix all err()/dbg() messages with the calling thread ID.
103103
var origDbg = dbg;
104-
dbg = (...args) => origDbg(pthreadLogPrefix() + args.join(' '));
104+
dbg = (...args) => origDbg(pthreadLogPrefix(), ...args);
105105
#if PTHREADS_DEBUG
106106
// With PTHREADS_DEBUG also prefix all err() messages.
107107
var origErr = err;
108-
err = (...args) => origErr(pthreadLogPrefix() + args.join(' '));
108+
err = (...args) => origErr(pthreadLogPrefix(), ...args);
109109
#endif
110110
},
111111
#endif

test/test_other.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14982,12 +14982,12 @@ def test_itimer_proxy_to_pthread(self):
1498214982
@node_pthreads
1498314983
def test_dbg(self):
1498414984
create_file('pre.js', '''
14985-
dbg('start');
14986-
Module.onRuntimeInitialized = () => dbg('done init');
14985+
dbg('start', { foo: 1});
14986+
Module.onRuntimeInitialized = () => dbg('done init', { bar: 1});
1498714987
''')
1498814988
expected = '''\
14989-
start
14990-
w:0,t:0x[0-9a-fA-F]+: done init
14989+
start { foo: 1 }
14990+
w:0,t:0x[0-9a-fA-F]+: done init { bar: 1 }
1499114991
hello, world!
1499214992
w:0,t:0x[0-9a-fA-F]+: native dbg message
1499314993
w:0,t:0x[0-9a-fA-F]+: hello

0 commit comments

Comments
 (0)