This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: interesting option of stap


On 02/19/2011 06:01 PM, Turgis, Frederic wrote:
> Hello,
> 
> Bug is actually present, it was OK only due to a typo (stap instead of ./stap).
> 
> /tmp/staprfxbPV/stap-symbols.h:127376: error: integer constant is too large for 'long' type
> /tmp/staprfxbPV/stap-symbols.h:127376: error: large integer implicitly truncated to unsigned type
> 
> static struct _stp_module _stp_module_0 = {
> ...
> .build_id_len = 20,
> .build_id_offset = 0xffffffff3fff8010, -> here is the issue for ARM
> .notes_sect = 0,
> };
> 
> Regards
> Fred

I looked where the constant is generated, translate.cxx. The constant being printed out is type GElf_Addr. In /usr/include/gelf.h that is a 64 bit type:

typedef Elf64_Addr GElf_Addr;

However, /usr/share/systemtap/runtime/sym.h struct _stp_module has the following:

	unsigned long  build_id_offset;

The attached patch would generate constants that match the type for build_id_offset field. However, I am not sure if that is entirely correct fix. 0xffffffff3fff8010 is a negative number with a really large magnitude. The stap "-vv" option should include output like the following:

Found build-id in kernel, length 20, start at 0xffffffff814d2b50

That would be able to determine whether build_id_vaddr is wrong or whether (base+extra_offset) in translate.cxx:dump_unwindsyms() is wrong.

-Will
diff --git a/translate.cxx b/translate.cxx
index 82f3ee4..55acdb0 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4951,7 +4951,7 @@ dump_unwindsyms (Dwfl_Module *m,
       {
         clog << "Found build-id in " << name
              << ", length " << build_id_len;
-        clog << ", start at 0x" << hex << build_id_vaddr
+        clog << ", start at 0x" << hex << (unsigned long) build_id_vaddr
              << dec << endl;
       }
   }
@@ -5406,12 +5406,12 @@ dump_unwindsyms (Dwfl_Module *m,
        correct either.  We may instead need a relocation basis different
        from _stext, such as __start_notes.  */
     if (modname == "kernel")
-      c->output << ".build_id_offset = 0x" << hex << build_id_vaddr - (base + extra_offset)
+	    c->output << ".build_id_offset = 0x" << hex << (unsigned long) build_id_vaddr - (base + extra_offset)
                 << dec << ",\n";
     // ET_DYN: task finder gives the load address. ET_EXEC: this is absolute address
     else
-      c->output << ".build_id_offset = 0x" << hex
-                << build_id_vaddr /* - base */
+	c->output << ".build_id_offset = 0x" << hex
+                << (unsigned long) build_id_vaddr /* - base */
                 << dec << ",\n";
   } else
     c->output << ".build_id_len = 0,\n";

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]