cleans up_exit, adds call to C++ destructors
This commit is contained in:
parent
2bde14a398
commit
6e2a7a12fe
@ -1,9 +1,8 @@
|
||||
/* See LICENSE of license details. */
|
||||
|
||||
#include "weak_under_alias.h"
|
||||
//#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#if defined(SEMIHOSTING)
|
||||
#include "semihosting.h"
|
||||
#endif
|
||||
@ -17,19 +16,17 @@ extern volatile uint32_t fromhost;
|
||||
#endif
|
||||
|
||||
void write_hex(int fd, uint32_t hex);
|
||||
extern void __libc_fini_array(void);
|
||||
|
||||
void __wrap_exit(int code) {
|
||||
|
||||
// volatile uint32_t* leds = (uint32_t*) (GPIO_BASE_ADDR + GPIO_OUT_OFFSET);
|
||||
#ifndef HAVE_NO_INIT_FINI
|
||||
__libc_fini_array();
|
||||
#endif
|
||||
const char message[] = "\nProgam has exited with code:";
|
||||
//*leds = (~(code));
|
||||
write(STDERR_FILENO, message, sizeof(message) - 1);
|
||||
write_hex(STDERR_FILENO, code);
|
||||
write(STDERR_FILENO, "\n", 1);
|
||||
write(STDERR_FILENO, "\n", 1);
|
||||
// tohost = (code << 1) + 1; // here used to stop simulation
|
||||
write(STDERR_FILENO, "\x04", 1);
|
||||
|
||||
tohost = (code << 1) + 1;
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user