emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.88k stars 3.32k forks source link

Enabling -sSOCKET_DEBUG= spams console with all kinds of debugging unrelated to sockets debugging. #22551

Open juj opened 2 months ago

juj commented 2 months ago

I am investigating a bug in our code regarding __syscall_send in pthreads proxied builds. Code works in singlethreaded builds, but doesn't in multithreaded. To quickly be able to figure out what is the discrepancy between ST and MT builds, I want to enable -sSOCKET_DEBUG=1 to be able to dump the WebSockets comms in each.

However, when I do that, I get a build that spams to me all sorts of other debug info and the interesting information that I want to debug with WebSockets is drowned in the noise:

image

making it impossible to find the actual sockets debug prints.

I see there's this construct:

image

and hence

image

Locally I can get rid of this by deleting the line

image

but it doesn't seem that SOCKET_DEBUG (or any of those xxx_DEBUGs for that matter?) should imply RUNTIME_DEBUG, that is counterproductive?

sbc100 commented 2 months ago

I've found it useful to enable RUNTIME_DEBUG automatically whenever I enable any of the other kinds of debugging.

The idea is that RUNTIME_DEBUG includes core stuff that its always useful to see.

However, I guess for some applications it doesn't make sense to include maybeExit or checkStackCookie since they seems to be happening so much.