<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10824">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Corey Farrell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">backtrace.c: Fix casting pointer to/from integral type.<br><br>The backtrace library bfd.h include file does not get the sizes of<br>pointers and ints right on some platforms. On my old test box the size<br>of bfd_vma is 8 while the size of a pointer is 4. gcc on the box<br>complains of the integer casting to/from pointers size mismatch.<br><br>* uintptr_t to the rescue by doing an appropriate two stage cast.<br><br>Change-Id: Icb2621583f50c8728de08a3c824d95fe53cc45d0<br>---<br>M main/backtrace.c<br>1 file changed, 5 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/backtrace.c b/main/backtrace.c</span><br><span>index 16f5a56..2623d7f 100644</span><br><span>--- a/main/backtrace.c</span><br><span>+++ b/main/backtrace.c</span><br><span>@@ -122,7 +122,7 @@</span><br><span> char *fn;</span><br><span> int inlined = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- offset = data->pc - (data->dynamic ? (bfd_vma) data->dli.dli_fbase : 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ offset = data->pc - (data->dynamic ? (bfd_vma)(uintptr_t) data->dli.dli_fbase : 0);</span><br><span> </span><br><span> if (!(bfd_get_section_flags(bfdobj, section) & SEC_ALLOC)) {</span><br><span> return;</span><br><span>@@ -151,11 +151,11 @@</span><br><span> /* file can possibly be null even with a success result from bfd_find_nearest_line */</span><br><span> file = file ? file : "";</span><br><span> fn = strrchr(file, '/');</span><br><span style="color: hsl(0, 100%, 40%);">-#define FMT_INLINED "[%s] %s %s:%u %s()"</span><br><span style="color: hsl(120, 100%, 40%);">+#define FMT_INLINED "[%s] %s %s:%u %s()"</span><br><span> #define FMT_NOT_INLINED "[%p] %s %s:%u %s()"</span><br><span> </span><br><span> snprintf(data->msg, MSG_BUFF_LEN, inlined ? FMT_INLINED : FMT_NOT_INLINED,</span><br><span style="color: hsl(0, 100%, 40%);">- inlined ? "inlined" : (char *)data->pc,</span><br><span style="color: hsl(120, 100%, 40%);">+ inlined ? "inlined" : (char *)(uintptr_t) data->pc,</span><br><span> data->libname,</span><br><span> fn ? fn + 1 : file,</span><br><span> line, S_OR(func, "???"));</span><br><span>@@ -192,14 +192,14 @@</span><br><span> struct bfd_data data = {</span><br><span> .return_strings = return_strings,</span><br><span> .msg = msg,</span><br><span style="color: hsl(0, 100%, 40%);">- .pc = (bfd_vma)addresses[stackfr],</span><br><span style="color: hsl(120, 100%, 40%);">+ .pc = (bfd_vma)(uintptr_t) addresses[stackfr],</span><br><span> .found = 0,</span><br><span> .dynamic = 0,</span><br><span> };</span><br><span> </span><br><span> msg[0] = '\0';</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!dladdr((void *)data.pc, &data.dli)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!dladdr((void *)(uintptr_t) data.pc, &data.dli)) {</span><br><span> continue;</span><br><span> }</span><br><span> data.libname = strrchr(data.dli.dli_fname, '/');</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10824">change 10824</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10824"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Icb2621583f50c8728de08a3c824d95fe53cc45d0 </div>
<div style="display:none"> Gerrit-Change-Number: 10824 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>