Move stack_trace.cpp to generic directory.

4 architectures are using it, so it is generic enough.
Make it error out for platforms where the stack grows in the other
direction. Another implementation can be added for them.

Change-Id: Ia52b5dd34da7b5ebcca0782af079c43d72ba3a8e
Reviewed-on: https://review.haiku-os.org/c/1340
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
PulkoMandy 2019-04-01 22:48:51 +02:00 committed by waddlesplash
parent e8f58ba4be
commit 2f2d56e2e3
5 changed files with 11 additions and 8 deletions

View File

@ -6,8 +6,10 @@
* Michael Lotz, mmlr@mlotz.ch
*/
#include <arch_config.h>
#include <libroot_private.h>
#ifdef STACK_GROWS_DOWNWARDS
/*! Captures a stack trace (the return addresses) of the current thread.
\param returnAddresses The array the return address shall be written to.
@ -45,3 +47,9 @@ __arch_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
return count;
}
#else
#error Implementation needed for upwards growing stacks
#endif

View File

@ -17,7 +17,6 @@ for architectureObject in [ MultiArchSubDirSetup ppc ] {
byteorder.S
compatibility.c # only here until the places where those functions
# are used are fixed
stack_trace.cpp
stack_frame.c
# systeminfo.c
system_time.c
@ -27,6 +26,7 @@ for architectureObject in [ MultiArchSubDirSetup ppc ] {
tls.c
generic_system_time_nsecs.cpp
stack_trace.cpp
;
}
}

View File

@ -27,6 +27,7 @@ for architectureObject in [ MultiArchSubDirSetup sparc ] {
generic_atomic.cpp
generic_system_time_nsecs.cpp
stack_trace.cpp
;
}
}

View File

@ -17,8 +17,6 @@ for architectureObject in [ MultiArchSubDirSetup x86 x86_gcc2 ] {
;
}
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) x86_common ] ;
MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o :
atomic.S
byteorder.S
@ -31,7 +29,6 @@ for architectureObject in [ MultiArchSubDirSetup x86 x86_gcc2 ] {
$(compatibilitySources)
# sources from x86_common
stack_trace.cpp
;
}

View File

@ -12,7 +12,6 @@ for architectureObject in [ MultiArchSubDirSetup x86_64 ] {
SEARCH_SOURCE +=
[ FDirName $(SUBDIR) $(DOTDOT) generic ]
[ FDirName $(SUBDIR) $(DOTDOT) x86_common ]
;
MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o :
@ -24,11 +23,9 @@ for architectureObject in [ MultiArchSubDirSetup x86_64 ] {
time.cpp
tls.cpp
# sources from x86_common
stack_trace.cpp
# sources from generic
generic_atomic.cpp
stack_trace.cpp
;
}
}