aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-19 19:27:22 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-19 19:27:22 -0700
commit7c243694549cc1d6776873c8a97c99fc5889b68d (patch)
tree229ac4852acce031fe2b0b36ab27250e8d6bd514 /src
parent46be5ac468db923bd3d19c55638b723aa760cd4e (diff)
fix building on Cygwin
Cygwin still doesn't support any of the backtrace functions. Also, remove a spurious newline from a debug message. Fixes #2993
Diffstat (limited to 'src')
-rw-r--r--src/common.cpp11
-rw-r--r--src/exec.cpp2
-rw-r--r--src/fallback.cpp8
-rw-r--r--src/fallback.h8
4 files changed, 11 insertions, 18 deletions
diff --git a/src/common.cpp b/src/common.cpp
index b8270ad1..91b08824 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -70,7 +70,9 @@ static volatile bool termsize_valid;
static rwlock_t termsize_rwlock;
static char *wcs2str_internal(const wchar_t *in, char *out);
+static void debug_shared(const wchar_t msg_level, const wcstring &msg);
+#ifdef HAVE_BACKTRACE_SYMBOLS
// This function produces a stack backtrace with demangled function & method names. It is based on
// https://gist.github.com/fmela/591333 but adapted to the style of the fish project.
static const wcstring_list_t __attribute__((noinline))
@@ -104,7 +106,6 @@ demangled_backtrace(int max_frames, int skip_levels) {
return backtrace_text;
}
-static void debug_shared(const wchar_t msg_level, const wcstring &msg);
void __attribute__((noinline)) show_stackframe(const wchar_t msg_level, int frame_count,
int skip_levels) {
ASSERT_IS_NOT_FORKED_CHILD();
@@ -124,6 +125,14 @@ void __attribute__((noinline)) show_stackframe(const wchar_t msg_level, int fram
}
}
+#else // HAVE_BACKTRACE_SYMBOLS
+
+void __attribute__((noinline)) show_stackframe(const wchar_t msg_level, int frame_count,
+ int skip_levels) {
+ debug_shared(msg_level, L"Sorry, but your system does not support backtraces");
+}
+#endif // HAVE_BACKTRACE_SYMBOLS
+
int fgetws2(wcstring *s, FILE *f) {
int i = 0;
wint_t c;
diff --git a/src/exec.cpp b/src/exec.cpp
index afd09f6a..aefdbc12 100644
--- a/src/exec.cpp
+++ b/src/exec.cpp
@@ -1058,7 +1058,7 @@ void exec_job(parser_t &parser, job_t *j) {
// A 0 pid means we failed to posix_spawn. Since we have no pid, we'll never get
// told when it's exited, so we have to mark the process as failed.
- debug(2, L"Fork #%d, pid %d: spawn external command '%s' from '%ls'\n",
+ debug(2, L"Fork #%d, pid %d: spawn external command '%s' from '%ls'",
g_fork_count, pid, actual_cmd, file ? file : L"<no file>");
if (pid == 0) {
job_mark_process_as_failed(j, p);
diff --git a/src/fallback.cpp b/src/fallback.cpp
index 96fa417b..dc5bcce2 100644
--- a/src/fallback.cpp
+++ b/src/fallback.cpp
@@ -332,14 +332,6 @@ int killpg(int pgr, int sig) {
}
#endif
-#ifndef HAVE_BACKTRACE
-int backtrace(void **buffer, int size) { return 0; }
-#endif
-
-#ifndef HAVE_BACKTRACE_SYMBOLS_FD
-char **backtrace_symbols_fd(void *const *buffer, int size, int fd) { return 0; }
-#endif
-
#ifndef HAVE_NAN
double nan(char *tagp) { return 0.0 / 0.0; }
#endif
diff --git a/src/fallback.h b/src/fallback.h
index a3143f09..f167ff69 100644
--- a/src/fallback.h
+++ b/src/fallback.h
@@ -149,12 +149,4 @@ int killpg(int pgr, int sig);
double nan(char *tagp);
#endif
-#ifndef HAVE_BACKTRACE
-int backtrace(void **buffer, int size);
-#endif
-
-#ifndef HAVE_BACKTRACE_SYMBOLS_FD
-char **backtrace_symbols_fd(void *const *buffer, int size, int fd);
-#endif
-
#endif