Commit ad5250ff authored by Evan Hunt's avatar Evan Hunt Committed by Ondřej Surý

Remove support for internal symbol table

Since we can no longer generate an internal symbol table, there
doesn't seem to be much reason to retain the code that reads it.
parent 1628f586
......@@ -25,7 +25,6 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
BIND9LIBS = ../../lib/bind9/libbind9.@A@
NSLIBS = ../../lib/ns/libns.@A@
......@@ -36,7 +35,6 @@ BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
NSDEPENDLIBS = ../../lib/ns/libns.@A@
LIBS = ${ISCLIBS} @LIBS@
NOSYMLIBS = ${ISCNOSYMLIBS} @LIBS@
SUBDIRS =
......
......@@ -28,7 +28,6 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
......@@ -43,8 +42,6 @@ RNDCDEPLIBS = ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${BIND9DEPLIBS} ${DNSDEPLIBS} ${I
LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@
NOSYMLIBS = ${DNSLIBS} ${ISCNOSYMLIBS} @LIBS@
CONFDEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
SRCS= rndc-confgen.c ddns-confgen.c
......
......@@ -25,7 +25,6 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
IRSLIBS = ../../lib/irs/libirs.@A@
......@@ -37,7 +36,6 @@ IRSDEPLIBS = ../../lib/irs/libirs.@A@
DEPLIBS = ${DNSDEPLIBS} ${IRSDEPLIBS} ${ISCCFGDEPLIBS} ${ISCDEPLIBS}
LIBS = ${DNSLIBS} ${IRSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@
NOSYMLIBS = ${DNSLIBS} ${IRSLIBS} ${ISCCFGLIBS} ${ISCNOSYMLIBS} @LIBS@
SUBDIRS =
......
......@@ -29,7 +29,6 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
IRSLIBS = ../../lib/irs/libirs.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
......@@ -44,9 +43,6 @@ DEPLIBS = ${DNSDEPLIBS} ${IRSDEPLIBS} ${BIND9DEPLIBS} \
LIBS = ${DNSLIBS} ${IRSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
${ISCLIBS} @LIBIDN2_LIBS@ @LIBS@
NOSYMLIBS = ${DNSLIBS} ${IRSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
${ISCNOSYMLIBS} @LIBIDN2_LIBS@ @LIBS@
SUBDIRS =
TARGETS = dig@EXEEXT@ host@EXEEXT@ nslookup@EXEEXT@
......
......@@ -24,7 +24,6 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
DNSDEPLIBS = ../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../lib/isc/libisc.@A@
......@@ -34,8 +33,6 @@ DEPLIBS = ${DNSDEPLIBS} ${ISCCFGDEPLIBS} ${ISCDEPLIBS}
LIBS = ${DNSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@
NOSYMLIBS = ${DNSLIBS} ${ISCCFGLIBS} ${ISCNOSYMLIBS} @LIBS@
# Alphabetically
TARGETS = dnssec-cds@EXEEXT@ dnssec-dsfromkey@EXEEXT@ \
dnssec-importkey@EXEEXT@ dnssec-keyfromlabel@EXEEXT@ \
......
......@@ -61,7 +61,6 @@ DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
BIND9LIBS = ../../lib/bind9/libbind9.@A@
NSLIBS = ../../lib/ns/libns.@A@
......@@ -80,11 +79,6 @@ LIBS = ${NSLIBS} ${DNSLIBS} ${BIND9LIBS} \
${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBCAP_LIBS@ \
@LIBS@
NOSYMLIBS = ${NSLIBS} ${DNSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBCAP_LIBS@ \
@LIBS@
SUBDIRS = unix
TARGETS = named@EXEEXT@
......@@ -101,8 +95,6 @@ OBJS = builtin.@O@ config.@O@ control.@O@ \
UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@
SYMOBJS = symtbl.@O@
GEOIP2LINKSRCS = geoip.c
SRCS = builtin.c config.c control.c \
......@@ -148,7 +140,6 @@ server.@O@: server.c
-DVERSION=\"${VERSION}\" -c ${srcdir}/server.c
named@EXEEXT@: ${OBJS} ${DEPLIBS}
export MAKE_SYMTABLE="yes"; \
export BASEOBJS="${OBJS} ${UOBJS}"; \
${FINALBUILDCMD}
......@@ -184,6 +175,3 @@ uninstall::
${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@
@DLZ_DRIVER_RULES@
named-symtbl.@O@: named-symtbl.c
${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c named-symtbl.c
......@@ -200,7 +200,6 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
int i, nframes;
isc_result_t result;
const char *logsuffix = "";
const char *fname;
/*
* Handle assertion failures.
......@@ -224,27 +223,10 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
isc_assertion_typetotext(type), cond, logsuffix);
if (result == ISC_R_SUCCESS) {
for (i = 0; i < nframes; i++) {
unsigned long offset;
fname = NULL;
result = isc_backtrace_getsymbol(
tracebuf[i], &fname, &offset);
if (result == ISC_R_SUCCESS) {
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN,
ISC_LOG_CRITICAL,
"#%d %p in %s()+0x%lx", i,
tracebuf[i], fname,
offset);
} else {
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN,
ISC_LOG_CRITICAL,
"#%d %p in ??", i,
tracebuf[i]);
}
isc_log_write(
named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"#%d %p in ??", i, tracebuf[i]);
}
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
......@@ -974,36 +956,6 @@ destroy_managers(void) {
isc_nm_destroy(&named_g_nm);
}
static void
dump_symboltable(void) {
int i;
isc_result_t result;
const char *fname;
const void *addr;
if (isc__backtrace_nsymbols == 0) {
return;
}
if (!isc_log_wouldlog(named_g_lctx, ISC_LOG_DEBUG(99))) {
return;
}
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_DEBUG(99), "Symbol table:");
for (i = 0, result = ISC_R_SUCCESS; result == ISC_R_SUCCESS; i++) {
addr = NULL;
fname = NULL;
result = isc_backtrace_getsymbolfromindex(i, &addr, &fname);
if (result == ISC_R_SUCCESS) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_DEBUG(99),
"[%d] %p %s", i, addr, fname);
}
}
}
static void
setup(void) {
isc_result_t result;
......@@ -1191,8 +1143,6 @@ setup(void) {
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"----------------------------------------------------");
dump_symboltable();
/*
* Get the initial resource limits.
*/
......
......@@ -29,7 +29,6 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
IRSLIBS = ../../lib/irs/libirs.@A@
......@@ -45,9 +44,6 @@ DEPLIBS = ${DNSDEPLIBS} ${IRSDEPLIBS} ${BIND9DEPLIBS} \
LIBS = ${DNSLIBS} ${IRSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCLIBS} @LIBS@
NOSYMLIBS = ${DNSLIBS} ${IRSLIBS} ${BIND9LIBS} \
${ISCCFGLIBS} ${ISCNOSYMLIBS} @LIBS@
SUBDIRS =
TARGETS = nsupdate@EXEEXT@
......
......@@ -24,7 +24,6 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
......@@ -35,7 +34,6 @@ DNSDEPLIBS = ../../lib/dns/libdns.@A@
BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
LIBS = ${ISCLIBS} @LIBS@
NOSYMLIBS = ${ISCNOSYMLIBS} @LIBS@
RNDCDEPLIBS = ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${BIND9DEPLIBS} ${DNSDEPLIBS} ${ISCDEPLIBS}
......
......@@ -22,12 +22,10 @@ BACKTRACECFLAGS = @BACKTRACECFLAGS@
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSDEPLIBS = ../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../lib/isc/libisc.@A@
ISCDEPNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
LIBS = @LIBS@
......
/backtrace_test.dSYM/
/backtrace_test0.dSYM/
/backtrace_test_nosymtbl
/backtrace_test_nosymtbl.dSYM/
/nsecify
......@@ -24,12 +24,10 @@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
DNSLIBS = ../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@
DNSDEPLIBS = ../../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../../lib/isc/libisc.@A@
ISCDEPNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@
ISCCFGDEPLIBS = ../../../lib/isccfg/libisccfg.@A@
LIBS = @LIBS@
......@@ -44,7 +42,6 @@ TARGETS = @XTARGETS@
XTARGETS = adb_test@EXEEXT@ \
byaddr_test@EXEEXT@ \
backtrace_test@EXEEXT@ \
backtrace_test_nosymtbl@EXEEXT@ \
byname_test@EXEEXT@ \
db_test@EXEEXT@ \
gsstest@EXEEXT@ \
......@@ -109,27 +106,10 @@ adb_test@EXEEXT@: adb_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ adb_test.@O@ \
${DNSLIBS} ${ISCLIBS} ${LIBS}
backtrace_test_nosymtbl@EXEEXT@: ${srcdir}/backtrace_test.c ${ISCDEPLIBS}
backtrace_test@EXEEXT@: ${srcdir}/backtrace_test.c ${ISCDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${BTTEST_CFLAGS} ${LDFLAGS} -o $@ \
${srcdir}/backtrace_test.c ${ISCLIBS} ${LIBS}
backtrace_test@EXEEXT@: ${srcdir}/backtrace_test.c backtrace_test_nosymtbl@EXEEXT@
#first step: create a first symbol table
rm -f symtbl.c
cp ${top_srcdir}/lib/isc/backtrace-emptytbl.c symtbl.c
#second step: build a binary with the first symbol table
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${BTTEST_CFLAGS} ${LDFLAGS} \
-o $@0 ${srcdir}/backtrace_test.c symtbl.c \
${ISCNOSYMLIBS} ${LIBS}
rm -f symtbl.c
#third step: create a second symbol table
cp ${top_srcdir}/lib/isc/backtrace-emptytbl.c symtbl.c
#fourth step: build the final binary
rm -f $@0
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${BTTEST_CFLAGS} ${LDFLAGS} \
-o $@ ${srcdir}/backtrace_test.c symtbl.c ${ISCNOSYMLIBS} ${LIBS}
rm -f symtbl.c
nsecify@EXEEXT@: nsecify.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ nsecify.@O@ \
${DNSLIBS} ${ISCLIBS} ${LIBS}
......
......@@ -16,16 +16,11 @@
#include <isc/print.h>
#include <isc/result.h>
const char *expected_symbols[] = { "func3", "func2", "func1", "main" };
static int
func3() {
void *tracebuf[16];
int i, nframes;
int error = 0;
const char *fname;
int nframes;
isc_result_t result;
unsigned long offset;
result = isc_backtrace_gettrace(tracebuf, 16, &nframes);
if (result != ISC_R_SUCCESS) {
......@@ -35,39 +30,12 @@ func3() {
}
if (nframes < 4) {
error++;
}
for (i = 0; i < 4 && i < nframes; i++) {
fname = NULL;
result = isc_backtrace_getsymbol(tracebuf[i], &fname, &offset);
if (result != ISC_R_SUCCESS) {
error++;
continue;
}
if (strcmp(fname, expected_symbols[i]) != 0) {
error++;
}
}
if (error) {
printf("Unexpected result:\n");
printf(" # of frames: %d (expected: at least 4)\n", nframes);
printf(" symbols:\n");
for (i = 0; i < nframes; i++) {
fname = NULL;
result = isc_backtrace_getsymbol(tracebuf[i], &fname,
&offset);
if (result == ISC_R_SUCCESS) {
printf(" [%d] %s\n", i, fname);
} else {
printf(" [%d] %p getsymbol failed: %s\n", i,
tracebuf[i], isc_result_totext(result));
}
}
return (1);
}
return (error);
return (0);
}
static int
......
......@@ -26,7 +26,6 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSDEPLIBS = ../../lib/dns/libdns.@A@
......@@ -35,7 +34,6 @@ ISCDEPLIBS = ../../lib/isc/libisc.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
LIBS = ${ISCLIBS} @LIBS@
NOSYMLIBS = ${ISCNOSYMLIBS} @LIBS@
SUBDIRS =
......
......@@ -64,7 +64,6 @@ OBJS = pk11.@O@ pk11_result.@O@ \
string.@O@ symtab.@O@ task.@O@ taskpool.@O@ \
tm.@O@ timer.@O@ version.@O@ \
${UNIXOBJS} ${THREADOBJS}
SYMTBLOBJS = backtrace-emptytbl.@O@
# Alphabetically
SRCS = pk11.c pk11_result.c \
......@@ -102,19 +101,19 @@ version.@O@: version.c
-DLIBAGE=${LIBAGE} \
-c ${srcdir}/version.c
libisc.@SA@: ${OBJS} ${SYMTBLOBJS}
${AR} ${ARFLAGS} $@ ${OBJS} ${SYMTBLOBJS}
libisc.@SA@: ${OBJS}
${AR} ${ARFLAGS} $@ ${OBJS}
${RANLIB} $@
libisc-nosymtbl.@SA@: ${OBJS}
${AR} ${ARFLAGS} $@ ${OBJS}
${RANLIB} $@
libisc.la: ${OBJS} ${SYMTBLOBJS}
libisc.la: ${OBJS}
${LIBTOOL_MODE_LINK} \
${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc.la -rpath ${libdir} \
-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
${OBJS} ${SYMTBLOBJS} ${LIBS}
${OBJS} ${LIBS}
libisc-nosymtbl.la: ${OBJS}
${LIBTOOL_MODE_LINK} \
......
......@@ -97,7 +97,6 @@ default_callback(const char *file, int line, isc_assertiontype_t type,
void *tracebuf[BACKTRACE_MAXFRAME];
int i, nframes;
const char *logsuffix = ".";
const char *fname;
isc_result_t result;
result = isc_backtrace_gettrace(tracebuf, BACKTRACE_MAXFRAME, &nframes);
......@@ -110,18 +109,7 @@ default_callback(const char *file, int line, isc_assertiontype_t type,
if (result == ISC_R_SUCCESS) {
for (i = 0; i < nframes; i++) {
unsigned long offset;
fname = NULL;
result = isc_backtrace_getsymbol(tracebuf[i], &fname,
&offset);
if (result == ISC_R_SUCCESS) {
fprintf(stderr, "#%d %p in %s()+0x%lx\n", i,
tracebuf[i], fname, offset);
} else {
fprintf(stderr, "#%d %p in ??\n", i,
tracebuf[i]);
}
fprintf(stderr, "#%d %p in ??\n", i, tracebuf[i]);
}
}
fflush(stderr);
......
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/*! \file */
/*
* This file defines an empty (default) symbol table used in backtrace.c
* If the application wants to have a complete symbol table, it should redefine
* isc__backtrace_symtable with the complete table in some way, and link the
* version of the library not including this definition
* (e.g. libisc-nosymbol.a).
*/
#include <isc/backtrace.h>
LIBISC_EXTERNAL_DATA const int isc__backtrace_nsymbols = 0;
LIBISC_EXTERNAL_DATA const isc_backtrace_symmap_t isc__backtrace_symtable[] = {
{ NULL, "" }
};
......@@ -221,80 +221,3 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes) {
return (ISC_R_NOTIMPLEMENTED);
}
#endif /* ifdef BACKTRACE_LIBC */
isc_result_t
isc_backtrace_getsymbolfromindex(int idx, const void **addrp,
const char **symbolp) {
REQUIRE(addrp != NULL && *addrp == NULL);
REQUIRE(symbolp != NULL && *symbolp == NULL);
if (idx < 0 || idx >= isc__backtrace_nsymbols) {
return (ISC_R_RANGE);
}
*addrp = isc__backtrace_symtable[idx].addr;
*symbolp = isc__backtrace_symtable[idx].symbol;
return (ISC_R_SUCCESS);
}
static int
symtbl_compare(const void *addr, const void *entryarg) {
const isc_backtrace_symmap_t *entry = entryarg;
const isc_backtrace_symmap_t *end =
&isc__backtrace_symtable[isc__backtrace_nsymbols - 1];
if (isc__backtrace_nsymbols == 1 || entry == end) {
if (addr >= entry->addr) {
/*
* If addr is equal to or larger than that of the last
* entry of the table, we cannot be sure if this is
* within a valid range so we consider it valid.
*/
return (0);
}
return (-1);
}
/* entry + 1 is a valid entry from now on. */
if (addr < entry->addr) {
return (-1);
} else if (addr >= (entry + 1)->addr) {
return (1);
}
return (0);
}
isc_result_t
isc_backtrace_getsymbol(const void *addr, const char **symbolp,
unsigned long *offsetp) {
isc_result_t result = ISC_R_SUCCESS;
isc_backtrace_symmap_t *found;
/*
* Validate the arguments: intentionally avoid using REQUIRE().
* See notes in backtrace.h.
*/
if (symbolp == NULL || *symbolp != NULL || offsetp == NULL) {
return (ISC_R_FAILURE);
}
if (isc__backtrace_nsymbols < 1) {
return (ISC_R_NOTFOUND);
}
/*
* Search the table for the entry that meets:
* entry.addr <= addr < next_entry.addr.
*/
found = bsearch(addr, isc__backtrace_symtable, isc__backtrace_nsymbols,
sizeof(isc__backtrace_symtable[0]), symtbl_compare);
if (found == NULL) {
result = ISC_R_NOTFOUND;
} else {
*symbolp = found->symbol;
*offsetp = (unsigned long)((const char *)addr -
(char *)found->addr);
}
return (result);
}
......@@ -39,18 +39,6 @@
#include <isc/types.h>
/***
*** Types
***/
struct isc_backtrace_symmap {
void * addr;
const char *symbol;
};
LIBISC_EXTERNAL_DATA extern const int isc__backtrace_nsymbols;
LIBISC_EXTERNAL_DATA extern const isc_backtrace_symmap_t
isc__backtrace_symtable[];
/***
*** Functions
***/
......@@ -77,49 +65,6 @@ isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes);
*\li #ISC_R_NOTFOUND
*\li #ISC_R_NOTIMPLEMENTED
*/
isc_result_t
isc_backtrace_getsymbolfromindex(int index, const void **addrp,
const char **symbolp);
/*%<
* Returns the content of the internal symbol table of the given index.
* On success, *addrsp and *symbolp point to the address and the symbol of
* the 'index'th entry of the table, respectively. If 'index' is not in the
* range of the symbol table, ISC_R_RANGE will be returned.
*
* Requires
*
*\li 'addrp' must be non NULL && '*addrp' == NULL.
*
*\li 'symbolp' must be non NULL && '*symbolp' == NULL.
*
* Returns:
*
*\li #ISC_R_SUCCESS
*\li #ISC_R_RANGE
*/
isc_result_t
isc_backtrace_getsymbol(const void *addr, const char **symbolp,
unsigned long *offsetp);
/*%<
* Searches the internal symbol table for the symbol that most matches the
* given 'addr'. On success, '*symbolp' will point to the name of function
* to which the address 'addr' belong, and '*offsetp' will store the offset
* from the function's entry address to 'addr'.
*
* Requires (note that these are not ensured by assertion checks, see above):
*
*\li 'symbolp' must be non NULL && '*symbolp' == NULL.
*
*\li 'offsetp' must be non NULL.
*
* Returns:
*
*\li #ISC_R_SUCCESS
*\li #ISC_R_FAILURE
*\li #ISC_R_NOTFOUND
*/
ISC_LANG_ENDDECLS
#endif /* ISC_BACKTRACE_H */
......@@ -31,13 +31,11 @@
/* Core Types. Alphabetized by defined type. */
typedef struct isc_astack isc_astack_t; /*%< Array-based fast stack */
typedef struct isc_appctx isc_appctx_t; /*%< Application context */
typedef struct isc_backtrace_symmap isc_backtrace_symmap_t; /*%< Symbol Table
* Entry */
typedef struct isc_buffer isc_buffer_t; /*%< Buffer */
typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */
typedef struct isc_constregion isc_constregion_t; /*%< Const region */
typedef struct isc_astack isc_astack_t; /*%< Array-based fast stack */
typedef struct isc_appctx isc_appctx_t; /*%< Application context */
typedef struct isc_buffer isc_buffer_t; /*%< Buffer */
typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */
typedef struct isc_constregion isc_constregion_t; /*%< Const region */
typedef struct isc_consttextregion isc_consttextregion_t; /*%< Const Text Region
*/
typedef struct isc_counter isc_counter_t; /*%< Counter */
......
......@@ -125,8 +125,6 @@ isc_appctx_destroy
isc_assertion_failed
isc_assertion_setcallback
isc_assertion_typetotext
isc_backtrace_getsymbol