Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3cf21a0
Wrote format_exception function and hard coded inclusion into system_…
hoodmane Feb 18, 2022
2ea06c8
Add Javascript wrapper, miscellaneous cleanup
hoodmane Feb 19, 2022
693f677
Fix formatting
hoodmane Feb 19, 2022
95ef456
No need for exportedAsmFunction
hoodmane Feb 20, 2022
103dca8
Use withStackSave
hoodmane Feb 20, 2022
cc31016
Free the right thing
hoodmane Feb 20, 2022
5ca4f18
Use stackAlloc({{{ POINTER_SIZE }}});
hoodmane Feb 20, 2022
aa15cc8
Remove accidental change
hoodmane Feb 20, 2022
493e22f
Add final newline to format_exception.cpp
hoodmane Feb 20, 2022
c7d1267
Add emscripten_ prefix to format_exception
hoodmane Feb 20, 2022
0231037
Add format_exception.cpp to libcxxabi
hoodmane Feb 20, 2022
af456b1
Use withStackSave correctly
hoodmane Feb 20, 2022
e233943
Remove libformatexception library
hoodmane Feb 20, 2022
83a1a4a
Various fixes
hoodmane Feb 20, 2022
5e765ab
Add test
hoodmane Feb 20, 2022
1235600
Remove addresses from test comparison
hoodmane Feb 20, 2022
a83007e
Try to fix test
hoodmane Feb 21, 2022
5f19ef5
Fix wasm-exceptions test
hoodmane Feb 21, 2022
86b703b
Fix test
hoodmane Feb 21, 2022
a773e9b
Fix INCLUDE_FULL_LIBRARY test
hoodmane Feb 21, 2022
16f160d
Fix flake8
hoodmane Feb 21, 2022
fbcf6da
Formatting fixes from sbc100
hoodmane Feb 22, 2022
8ad7932
Fix test
hoodmane Feb 22, 2022
68c129e
Return char* instead of returning by value to avoid stackAlloc
hoodmane Feb 22, 2022
c11d036
Remove FORMAT_EXCEPTION_SUPPORT setting
hoodmane Feb 22, 2022
9c0b0a6
Address more review comments
hoodmane Feb 22, 2022
439c09f
Address more review comments
hoodmane Feb 22, 2022
77376ea
Remove unneeded setting
hoodmane Feb 22, 2022
8dad972
Add formatException to EXPORTED_FUNCTIONS rather than EXPORTED_RUNTIM…
hoodmane Feb 22, 2022
dcc15f5
Edits from code review
hoodmane Feb 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Formatting fixes from sbc100
  • Loading branch information
hoodmane committed Feb 22, 2022
commit fbcf6da21d9349e40fc920ec3b90948475d4b3f0
4 changes: 2 additions & 2 deletions src/library_exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ var LibraryExceptions = {

#if !DISABLE_EXCEPTION_CATCHING
$formatException__deps: ["emscripten_format_exception", "$withStackSave", "free"],
$formatException: function(excPtr){
return withStackSave(function(){
$formatException: function(excPtr) {
return withStackSave(function(){
var result_ptr = stackAlloc({{{ POINTER_SIZE }}});
_emscripten_format_exception(result_ptr, excPtr);
var utf8_addr = {{{ makeGetValue('result_ptr', '0', '*') }}};
Expand Down
1 change: 0 additions & 1 deletion system/lib/libcxxabi/src/format_exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#ifdef __USING_EMSCRIPTEN_EXCEPTIONS__

extern "C" {
#define DEMANGLED_BUF_SIZE 100

int __cxa_can_catch(const std::type_info* catchType,
const std::type_info* excpType,
Expand Down
31 changes: 13 additions & 18 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,21 +1550,17 @@ def test_format_exception(self):
self.set_setting('FORMAT_EXCEPTION_SUPPORT')
self.set_setting('DISABLE_EXCEPTION_CATCHING', 0)
self.maybe_closure()
self.do_run(
"""
self.do_run('''
#include <emscripten.h>
#include <exception>
#include <stdexcept>
using namespace std;

class myexception : public exception
{
class myexception : public exception {
virtual const char* what() const throw() { return "My exception happened"; }
} myex;

extern "C" void
throw_exc(int x)
{
extern "C" void throw_exc(int x) {
if (x == 1) {
throw 1000;
}
Expand All @@ -1582,25 +1578,24 @@ class myexception : public exception
}
}

int
main(){
int main() {
EM_ASM({
for(let i = 1; i < 6; i++){
for (let i = 1; i < 6; i++){
try {
Module["_throw_exc"](i);
} catch(p){
} catch(p) {
console.log(Module["formatException"](p).replace(/0x[0-9a-f]*/, "xxx"));
}
}
});
}
""",
"Cpp Exception: The exception is an object of type 'int' at address xxx which does not inherit from std::exception\n"
"Cpp Exception: The exception is an object of type 'char' at address xxx which does not inherit from std::exception\n"
"Cpp Exception std::runtime_error: abc\n"
"Cpp Exception myexception: My exception happened\n"
"Cpp Exception: The exception is an object of type 'char const*' at address xxx which does not inherit from std::exception\n"
)
''', '''
Cpp Exception: The exception is an object of type 'int' at address xxx which does not inherit from std::exception
Cpp Exception: The exception is an object of type 'char' at address xxx which does not inherit from std::exception
Cpp Exception std::runtime_error: abc
Cpp Exception myexception: My exception happened
Cpp Exception: The exception is an object of type 'char const*' at address xxx which does not inherit from std::exception
''')

@with_both_eh_sjlj
def test_bad_typeid(self):
Expand Down
2 changes: 1 addition & 1 deletion tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ def get_files(self):
'stdlib_stdexcept.cpp',
'stdlib_typeinfo.cpp',
'private_typeinfo.cpp',
'format_exception.cpp'
'format_exception.cpp',
]
if self.eh_mode == Exceptions.NONE:
filenames += ['cxa_noexception.cpp']
Expand Down