[PATCH] D144174: [Support][RISCV] Disable use of backtrace() for RISC-V backtraces
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 16 02:11:50 PST 2023
luismarques created this revision.
Herald added subscribers: VincentWu, vkmr, evandro, sameer.abuasal, s.egerton, Jim, benna, psnobl, PkmX, rogfer01, shiva0217, kito-cheng, simoncook, hiraditya, arichardson.
Herald added a project: All.
luismarques requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD.
Herald added a project: LLVM.
AFAIK `backtrace` is fundamentally broken for RISC-V, even if you compile everything with frame pointers. Even if it could be fixed, right now it's broken in ~all systems so I think it's best to disable it for RISC-V.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144174
Files:
llvm/lib/Support/Unix/Signals.inc
Index: llvm/lib/Support/Unix/Signals.inc
===================================================================
--- llvm/lib/Support/Unix/Signals.inc
+++ llvm/lib/Support/Unix/Signals.inc
@@ -561,8 +561,11 @@
#if ENABLE_BACKTRACES
static void *StackTrace[256];
int depth = 0;
-#if defined(HAVE_BACKTRACE)
+#if defined(HAVE_BACKTRACE) && !defined(__riscv)
// Use backtrace() to output a backtrace on Linux systems with glibc.
+ // Don't use it on RISC-V Linux because it's highly unlikely to work but it
+ // may return 1 or 2 entries, preventing the retry with _Unwind_Backtrace
+ // below.
if (!depth)
depth = backtrace(StackTrace, static_cast<int>(std::size(StackTrace)));
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144174.497754.patch
Type: text/x-patch
Size: 701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230216/b7cb2bb5/attachment.bin>
More information about the llvm-commits
mailing list