Bug 450229 - dwfl_module_getsrc doesn't allow for bias
Summary: dwfl_module_getsrc doesn't allow for bias
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: elfutils
Version: 8
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 173278
TreeView+ depends on / blocked
 
Reported: 2008-06-06 00:48 UTC by Andrew Cagney
Modified: 2008-08-14 10:21 UTC (History)
0 users

Fixed In Version: 0.135
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-08-14 10:21:59 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
fix (1.12 KB, text/plain)
2008-06-07 12:07 UTC, Andrew Cagney
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Sourceware 6600 0 None None None Never

Description Andrew Cagney 2008-06-06 00:48:31 UTC
(unless of course the caller is expected to)

@@ -56,18 +57,24 @@ dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr)
   Dwarf_Addr bias;
   if (INTUSE(dwfl_module_getdwarf) (mod, &bias) == NULL)
     return NULL;
+  fprintf(stderr, "got dwarf 0x%lx\n", addr);
 
   struct dwfl_cu *cu;
   Dwfl_Error error = __libdwfl_addrcu (mod, addr, &cu);
   if (likely (error == DWFL_E_NOERROR))
     error = __libdwfl_cu_getsrclines (cu);
+  fprintf(stderr, "got addrcu\n");
   if (likely (error == DWFL_E_NOERROR))
     {
+      addr = addr - bias;
+      fprintf(stderr, "searching unbiased 0x%lx\n", (long) addr);
       /* The lines are sorted by address, so we can use binary search.  */
       size_t l = 0, u = cu->die.cu->lines->nlines;
       while (l < u)
        {
          size_t idx = (l + u) / 2;
+         fprintf(stderr, "%d 0x%lx\n", (int)idx,
+                 (long) cu->die.cu->lines->info[idx].addr);
          if (addr < cu->die.cu->lines->info[idx].addr)
            u = idx;
          else if (addr > cu->die.cu->lines->info[idx].addr)

which gives the improved effect:

got dwarf 0x2aaab057683c
addrarange 2aaab057683c
naranges 859
adjusted 6e83c by bias 2aaab0508000
found arange at 624
got addrcu
searching unbiased 0x6e83c
73 0x6e950
36 0x57fba
55 0x6e87b
46 0x6e83c

Comment 1 Andrew Cagney 2008-06-07 12:07:43 UTC
Created attachment 308607 [details]
fix

Just the patch.

Comment 2 Roland McGrath 2008-08-14 10:21:59 UTC
This report never supplied a test case, so there is none to verify.
This was fixed in 0.135.


Note You need to log in before you can comment on or make changes to this bug.