selection and WIN64 builds. This is a work in
progress. [RT #34160]
(cherry picked from commit c3c8823fed)
Conflicts:
CHANGES
bin/check/win32/checktool.dsp.in
bin/dnssec/win32/dnssectool.dsp.in
bin/dnssec/win32/importkey.dsp.in
bin/dnssec/win32/importkey.mak.in
bin/named/geoip.c
bin/named/include/named/geoip.h
bin/tools/win32/rrchecker.dsp.in
bin/tools/win32/rrchecker.mak.in
config.h.win32
lib/dns/geoip.c
lib/dns/master.c
lib/dns/win32/libdns.dsp.in
lib/dns/win32/libdns.mak.in
lib/isc/mem.c
lib/isc/stats.c
lib/isc/win32/file.c
lib/isc/win32/libisc.def.in
lib/isc/win32/libisc.mak.in
lib/isc/win32/stdio.c
lib/isccc/cc.c
win32utils/BuildAll.bat
win32utils/BuildSetup.bat
win32utils/legacy/BINDBuild.dsw.in
win32utils/makeversion.pl
win32utils/setpk11provider.pl
win32utils/updatelibxml2.pl
win32utils/win32-build.txt
98 lines
2.2 KiB
C
98 lines
2.2 KiB
C
/*
|
|
* Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
/* $Id: backtrace_test.c,v 1.4 2009/09/02 23:48:01 tbox Exp $ */
|
|
|
|
#include <config.h>
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include <isc/backtrace.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;
|
|
isc_result_t result;
|
|
unsigned long offset;
|
|
|
|
result = isc_backtrace_gettrace(tracebuf, 16, &nframes);
|
|
if (result != ISC_R_SUCCESS) {
|
|
printf("isc_backtrace_gettrace failed: %s\n",
|
|
isc_result_totext(result));
|
|
return (1);
|
|
}
|
|
|
|
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 (error);
|
|
}
|
|
|
|
static int
|
|
func2() {
|
|
return (func3());
|
|
}
|
|
|
|
static int
|
|
func1() {
|
|
return (func2());
|
|
}
|
|
|
|
int
|
|
main() {
|
|
return (func1());
|
|
}
|