* [PATCH] MSP430: Define exit () in C code
@ 2019-10-08 11:06 Jozef Lawrynowicz
2019-10-10 13:21 ` Jozef Lawrynowicz
0 siblings, 1 reply; 2+ messages in thread
From: Jozef Lawrynowicz @ 2019-10-08 11:06 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 0001-MSP430-Define-exit-in-C-code.patch --]
[-- Type: text/x-patch, Size: 2539 bytes --]
From 421a876debc3f370dabb6f702f29aaa730689c64 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Tue, 8 Oct 2019 11:53:44 +0100
Subject: [PATCH] MSP430: Define exit () in C code
The debug information emitted by the GNU assembler is not sufficient for
the TI CCS Debugger to be able to display debug information when we
reach a library functon such as exit ().
This is problematic for exit () in particular, as it is not immediately
obvious whether the program serious malfunctioned or exit () has been
called.
By defining exit () in C code, sufficient debug information is generated
that the TI CCS Debugger can display debug information such as function
name and the call frame.
---
libgloss/msp430/Makefile.in | 1 +
libgloss/msp430/ciosyscalls.S | 8 --------
libgloss/msp430/exit.c | 14 ++++++++++++++
3 files changed, 15 insertions(+), 8 deletions(-)
create mode 100644 libgloss/msp430/exit.c
diff --git a/libgloss/msp430/Makefile.in b/libgloss/msp430/Makefile.in
index 59c11a9a9..f9fe69300 100644
--- a/libgloss/msp430/Makefile.in
+++ b/libgloss/msp430/Makefile.in
@@ -74,6 +74,7 @@ SIM_OBJS = syscalls.o \
NOSYS_OBJS = ciosyscalls.o \
cio.o \
write.o \
+ exit.o \
unlink.o \
sbrk.o
diff --git a/libgloss/msp430/ciosyscalls.S b/libgloss/msp430/ciosyscalls.S
index 889deae9e..32a9ad4ed 100644
--- a/libgloss/msp430/ciosyscalls.S
+++ b/libgloss/msp430/ciosyscalls.S
@@ -46,14 +46,6 @@
.endm
-START_FUNC exit, _exit
- /* For some reason, the board fails to stop at a breakpoint
- placed on top of a software breakpoint instruction. */
-/* MOV.B #0,R3 ; this is a software breakpoint instruction */
-1: br_ #1b
-END_FUNC exit, _exit
-
-
START_FUNC isatty,_isatty
MOV #1,R12
ret_
diff --git a/libgloss/msp430/exit.c b/libgloss/msp430/exit.c
new file mode 100644
index 000000000..0f110dc96
--- /dev/null
+++ b/libgloss/msp430/exit.c
@@ -0,0 +1,14 @@
+/* Implement exit () in C code so we get debugging information when reaching
+ exit in the TI CCS debugger.
+ The debug information emitted by the assembler is not sufficient for
+ any meaningful debug information to be displayed. */
+void __attribute__((naked, weak))
+exit (int status __attribute__((unused)))
+{
+ /* For some reason, the board fails to stop at a breakpoint
+ placed on top of a software breakpoint instruction. */
+ /* __asm__("MOV.B #0,R3") ; this is a software breakpoint instruction */
+ while(1);
+}
+
+void _exit (int) __attribute__((weak, alias ("exit")));
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] MSP430: Define exit () in C code
2019-10-08 11:06 [PATCH] MSP430: Define exit () in C code Jozef Lawrynowicz
@ 2019-10-10 13:21 ` Jozef Lawrynowicz
0 siblings, 0 replies; 2+ messages in thread
From: Jozef Lawrynowicz @ 2019-10-10 13:21 UTC (permalink / raw)
To: newlib
I forgot to add, that if the patch is acceptable, I would appreciate if
someone would commit it for me, as I do not have write access.
Thanks,
Jozef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-10 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 11:06 [PATCH] MSP430: Define exit () in C code Jozef Lawrynowicz
2019-10-10 13:21 ` Jozef Lawrynowicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).