Open Flyingbeanss opened 1 year ago
Hmm.. it looks like convertPCtoSourceLocation
must be returning a result that doesn't have a .file
attribute so undefined
is being passed to stringToNewUTF8
here: https://github.com/emscripten-core/emscripten/blob/9429b4893c5e376e23e67d7007d2b948987445a0/src/library.js#L2819
Strange that we have never seen this before.
Can you try adding -g
and/or --profiling-funcs
to your compile and link flags?
@sbc100 Thanks for reply. Actually, I have added set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
and set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g")
. After I add set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --profiling-funcs")
and set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --profiling-funcs")
, it seems to be no change in the console.
Can you take look devtools a few levels up the stack in emscripten_pc_get_file
? Can you see what result
contains? (The thing that convertPCtoSourceLocation
returns?)
@sbc100 Thanks for your advice. I'm not very familiar with js and browser.
var result = convertPCtoSourceLocation(pc);
if (!result) return 0;
convertPCtoSourceLocation(pc);
returns null
When the crash happens though I'm pretty such it doesn't return null, since it does not return there but goes on to call stringToNewUTF8
below. You need to somehow pause/break when the exceptions happens. Try "Pause on exceptions" in devtools.
Then select the emscripten_pc_get_file
and type result
in the console to see its contents (or inspect it using the Locals pane).
Thank you for being so patient.I make a mistake, it's not null. The convertPCtoSourceLocation(pc);
will be called many times.After a certain call, it returns undefined
.The content is here:
Hi! I want to deal with
memory access out of bound
in my program. After I addset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
andset(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
, the console print as follow:I just don't understand why. Here is the original output.
Thanks for help , sincerely!