backtrace.c (79aad27f) | backtrace.c (f9124e1e) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 170 unchanged lines hidden (view full) --- 179 Dl_info dli; 180 ptrdiff_t offset; 181 182 if ( 0 != dladdr( *pFramePtr, &dli ) ) 183 { 184 if ( dli.dli_fname && dli.dli_fbase ) 185 { 186 offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 170 unchanged lines hidden (view full) --- 179 Dl_info dli; 180 ptrdiff_t offset; 181 182 if ( 0 != dladdr( *pFramePtr, &dli ) ) 183 { 184 if ( dli.dli_fname && dli.dli_fbase ) 185 { 186 offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_fbase; |
187#if defined X86_64 188 fprintf( fp, "%s+0x%lx", dli.dli_fname, offset ); 189#else |
|
187 fprintf( fp, "%s+0x%x", dli.dli_fname, offset ); | 190 fprintf( fp, "%s+0x%x", dli.dli_fname, offset ); |
191#endif |
|
188 } 189 if ( dli.dli_sname && dli.dli_saddr ) 190 { 191 offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; | 192 } 193 if ( dli.dli_sname && dli.dli_saddr ) 194 { 195 offset = (ptrdiff_t)*pFramePtr - (ptrdiff_t)dli.dli_saddr; |
196#if defined X86_64 197 fprintf( fp, "(%s+0x%lx)", dli.dli_sname, offset ); 198#else |
|
192 fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); | 199 fprintf( fp, "(%s+0x%x)", dli.dli_sname, offset ); |
200#endif |
|
193 } 194 } | 201 } 202 } |
195 fprintf( fp, "[0x%x]\n", *pFramePtr ); | 203 fprintf( fp, "[0x%p]\n", *pFramePtr ); |
196 } 197 fflush( fp ); 198 fclose( fp ); 199 } 200} 201#endif /* defined FREEBSD */ 202 203#ifdef LINUX --- 152 unchanged lines hidden --- | 204 } 205 fflush( fp ); 206 fclose( fp ); 207 } 208} 209#endif /* defined FREEBSD */ 210 211#ifdef LINUX --- 152 unchanged lines hidden --- |