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