summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-09-22 06:45:07 +0000
committeravg <avg@FreeBSD.org>2010-09-22 06:45:07 +0000
commit98648775410aacffb472684a04b9eb6a99041957 (patch)
treea518f0cad0f2d2ea8503a6ea24075ef20a0e9117 /sys/kern/kern_linker.c
parent4cccdc71390803142b8cc0867784eb3d3c52017d (diff)
downloadFreeBSD-src-98648775410aacffb472684a04b9eb6a99041957.zip
FreeBSD-src-98648775410aacffb472684a04b9eb6a99041957.tar.gz
kdb_backtrace: use stack_print_ddb instead of stack_print
This is a followup to r212964. stack_print call chain obtains linker sx lock and thus potentially may lead to a deadlock depending on a kind of a panic. stack_print_ddb doesn't acquire any locks and it doesn't use any facilities of ddb backend. Using stack_print_ddb outside of DDB ifdef required taking a number of helper functions from under it as well. It is a good idea to rename linker_ddb_* and stack_*_ddb functions to have 'unlocked' component in their name instead of 'ddb', because those functions do not use any DDB services, but instead they provide unlocked access to linker symbol information. The latter was previously needed only for DDB, hence the 'ddb' name component. Alternative is to ditch unlocked versions altogether after implementing proper panic handling: 1. stop other cpus upon a panic 2. make all non-spinlock lock operations (mutex, sx, rwlock) be a no-op when panicstr != NULL Suggested by: mdf Discussed with: attilio MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index dd29302..43ccd74 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -924,7 +924,6 @@ linker_debug_search_symbol_name(caddr_t value, char *buf, u_int buflen,
return (0);
}
-#ifdef DDB
/*
* DDB Helpers. DDB has to look across multiple files with their own symbol
* tables and string tables.
@@ -933,12 +932,14 @@ linker_debug_search_symbol_name(caddr_t value, char *buf, u_int buflen,
* DDB to hang because somebody's got the lock held. We'll take the chance
* that the files list is inconsistant instead.
*/
+#ifdef DDB
int
linker_ddb_lookup(const char *symstr, c_linker_sym_t *sym)
{
return (linker_debug_lookup(symstr, sym));
}
+#endif
int
linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
@@ -961,7 +962,6 @@ linker_ddb_search_symbol_name(caddr_t value, char *buf, u_int buflen,
return (linker_debug_search_symbol_name(value, buf, buflen, offset));
}
-#endif
/*
* stack(9) helper for non-debugging environemnts. Unlike DDB helpers, we do
OpenPOWER on IntegriCloud