Deleted Added
sdiff udiff text old ( 234010 ) new ( 262706 )
full compact
1/*
2 * Copyright (C) 2009, 2013 Internet Systems Consortium, Inc. ("ISC")
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,

--- 35 unchanged lines hidden (view full) ---

46 * the RBP register in such a case. If the backtrace function itself crashes
47 * due to this problem, the whole package should be rebuilt with
48 * --disable-backtrace.
49 */
50#ifdef HAVE_LIBCTRACE
51#define BACKTRACE_LIBC
52#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__ia64__))
53#define BACKTRACE_GCC
54#elif defined(WIN32)
55#define BACKTRACE_WIN32
56#elif defined(__x86_64__) || defined(__i386__)
57#define BACKTRACE_X86STACK
58#else
59#define BACKTRACE_DISABLED
60#endif /* HAVE_LIBCTRACE */
61#else /* !ISC_PLATFORM_USEBACKTRACE */
62#define BACKTRACE_DISABLED
63#endif /* ISC_PLATFORM_USEBACKTRACE */

--- 60 unchanged lines hidden (view full) ---

124 arg.max_depth = maxaddrs;
125 arg.count = 0;
126 _Unwind_Backtrace(btcallback, &arg);
127
128 *nframes = arg.count;
129
130 return (ISC_R_SUCCESS);
131}
132#elif defined(BACKTRACE_WIN32)
133isc_result_t
134isc_backtrace_gettrace(void **addrs, int maxaddrs, int *nframes) {
135 unsigned long ftc = (unsigned long)maxaddrs;
136
137 *nframes = (int)CaptureStackBackTrace(1, ftc, addrs, NULL);
138 return ISC_R_SUCCESS;
139}
140#elif defined(BACKTRACE_X86STACK)
141#ifdef __x86_64__
142static unsigned long
143getrbp() {
144 __asm("movq %rbp, %rax\n");
145}
146#endif
147

--- 135 unchanged lines hidden (view full) ---

283 * entry.addr <= addr < next_entry.addr.
284 */
285 found = bsearch(addr, isc__backtrace_symtable, isc__backtrace_nsymbols,
286 sizeof(isc__backtrace_symtable[0]), symtbl_compare);
287 if (found == NULL)
288 result = ISC_R_NOTFOUND;
289 else {
290 *symbolp = found->symbol;
291 *offsetp = (unsigned long) ((const char *)addr -
292 (char *)found->addr);
293 }
294
295 return (result);
296}