| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: backtrace.c,v 1.1.1.1 2009/10/25 00:02:42 christos Exp $ */ | | 1 | /* $NetBSD: backtrace.c,v 1.2 2009/10/25 20:53:43 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") | | 4 | * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") |
5 | * | | 5 | * |
6 | * Permission to use, copy, modify, and/or distribute this software for any | | 6 | * Permission to use, copy, modify, and/or distribute this software for any |
7 | * purpose with or without fee is hereby granted, provided that the above | | 7 | * purpose with or without fee is hereby granted, provided that the above |
8 | * copyright notice and this permission notice appear in all copies. | | 8 | * copyright notice and this permission notice appear in all copies. |
9 | * | | 9 | * |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH | | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH |
11 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | | 11 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
12 | * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, | | 12 | * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, |
13 | * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | | 13 | * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
14 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE | | 14 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE |
| @@ -177,27 +177,27 @@ isc_backtrace_gettrace(void **addrs, int | | | @@ -177,27 +177,27 @@ isc_backtrace_gettrace(void **addrs, int |
177 | if (sp == NULL) | | 177 | if (sp == NULL) |
178 | return (ISC_R_NOTFOUND); | | 178 | return (ISC_R_NOTFOUND); |
179 | /* | | 179 | /* |
180 | * sp is the frame ptr of this function itself due to the call to | | 180 | * sp is the frame ptr of this function itself due to the call to |
181 | * getrbp(), so need to unwind one frame for consistency. | | 181 | * getrbp(), so need to unwind one frame for consistency. |
182 | */ | | 182 | */ |
183 | sp = getnextframeptr(sp); | | 183 | sp = getnextframeptr(sp); |
184 | #else | | 184 | #else |
185 | /* | | 185 | /* |
186 | * i386: the frame pointer is stored 2 words below the address for the | | 186 | * i386: the frame pointer is stored 2 words below the address for the |
187 | * first argument. Note that the body of this function cannot be | | 187 | * first argument. Note that the body of this function cannot be |
188 | * inlined since it depends on the address of the function argument. | | 188 | * inlined since it depends on the address of the function argument. |
189 | */ | | 189 | */ |
190 | sp = (void **)&addrs - 2; | | 190 | sp = (void **)(void *)&addrs - 2; |
191 | #endif | | 191 | #endif |
192 | | | 192 | |
193 | while (sp != NULL && i < maxaddrs) { | | 193 | while (sp != NULL && i < maxaddrs) { |
194 | addrs[i++] = *(sp + 1); | | 194 | addrs[i++] = *(sp + 1); |
195 | sp = getnextframeptr(sp); | | 195 | sp = getnextframeptr(sp); |
196 | } | | 196 | } |
197 | | | 197 | |
198 | *nframes = i; | | 198 | *nframes = i; |
199 | | | 199 | |
200 | return (ISC_R_SUCCESS); | | 200 | return (ISC_R_SUCCESS); |
201 | } | | 201 | } |
202 | #elif defined(BACKTRACE_DISABLED) | | 202 | #elif defined(BACKTRACE_DISABLED) |
203 | isc_result_t | | 203 | isc_result_t |