disable uglify on result of .js file

Asked by Paul

I'm curious how to disable uglify when using cmake toolchain of Cheerp i tried with SOURCEMAP true and no luck.

cmake -DCMAKE_TOOLCHAIN_FILE=/Applications/cheerp/share/cmake/Modules/CheerpToolchain.cmake -DCMAKE_SYST
EM_NAME=cheerp ..

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Cheerp Edit question
Assignee:
No assignee Edit question
Solved by:
Paul
Solved:
Last query:
Last reply:
Revision history for this message
Yuri Iozzelli (yuri91) said :
#1

Hi Paul,

You can disable the source compression with the linker flag `-cheerp-pretty-code`:

SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -cheerp-pretty-code")

Revision history for this message
Paul (lynxpaul) said :
#2

That worked! However, the function names are like hashed
ie.
function __ZNSt10__function6__funcIZN3apl13OpenURLAction5startEvE3

etc.

is this normal? Curious how to debug this.
Thanks

Revision history for this message
Yuri Iozzelli (yuri91) said :
#3

What you see is the C++ name mangling (https://en.wikipedia.org/wiki/Name_mangling).
You can try to demangle it with the c++filt tool, but it doesn't work all the time (in your particular example, It did not work for me).

Also, note that cheerp adds a leading underscore to every function, so the string that you pass to c++filt needs to have one removed.

A quick and dirty way of demangling all C++ functions in a file is the following:

cat myfile.js | sed 's/__Z/_Z/g' | c++filt

Revision history for this message
Yuri Iozzelli (yuri91) said :
#4

(of course the result is not valid js and it will not run, but it can be helpful for debugging)

Revision history for this message
Paul (lynxpaul) said :
#5

Great thanks a lot Yuri!!!