Compilation error on non-utrace kernel

Wenji Huang wenji.huang@oracle.com
Mon Aug 17 07:35:00 GMT 2009


Hi,

I got the compilation error for the latest stap source code.
$ stap -e 'probe kernel.function("sys_open"){print("ok") exit()}'

In file included from 
/tmp/stapXCcyVM/stap_930864172fe8fa9b4147b46cc0065554_759.c:724:
/tmp/stapXCcyVM/stap-symbols.h:109454: error: unknown field ‘pathname’ 
specified in initializer
cc1: warnings being treated as errors
/tmp/stapXCcyVM/stap-symbols.h:109454: warning: excess elements in 
struct initializer
/tmp/stapXCcyVM/stap-symbols.h:109454: warning: (near initialization for 
‘_stp_vmcb_0’)
/tmp/stapXCcyVM/stap-symbols.h:109455: error: unknown field 
‘mmap_callback’ specified in initializer
/tmp/stapXCcyVM/stap-symbols.h:109455: warning: excess elements in 
struct initializer
/tmp/stapXCcyVM/stap-symbols.h:109455: warning: (near initialization for 
‘_stp_vmcb_0’)
/tmp/stapXCcyVM/stap-symbols.h:109456: error: unknown field 
‘munmap_callback’ specified in initializer
/tmp/stapXCcyVM/stap-symbols.h:109456: warning: excess elements in 
struct initializer
/tmp/stapXCcyVM/stap-symbols.h:109456: warning: (near initialization for 
‘_stp_vmcb_0’)
make[1]: *** 
[/tmp/stapXCcyVM/stap_930864172fe8fa9b4147b46cc0065554_759.o] Error 1
make: *** [_module_/tmp/stapXCcyVM] Error 2
Pass 4: compilation failed.  Try again with another '--vp 0001' option.

The structure definition isn't resolved. Seems the following patch can 
fix it.

diff --git a/translate.cxx b/translate.cxx
index 69b1630..851c6a7 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4836,11 +4836,13 @@ dump_unwindsyms (Dwfl_Module *m,
    if (mainfile[0] == '/') // user-space module
      {
        // NB: runtime/sym.c
+      c->output << "#if defined(CONFIG_UTRACE)\n";
        c->output << "static struct stap_task_finder_target _stp_vmcb_" 
<< stpmod_idx << "= {\n";
        c->output << ".pathname = " << lex_cast_qstring (mainfile) << ",\n";
        c->output << ".mmap_callback = &_stp_tf_mmap_cb,\n";
        c->output << ".munmap_callback = &_stp_tf_munmap_cb,\n";
        c->output << "};\n";
+      c->output << "#endif\n";
      }

    c->output << "static struct _stp_module _stp_module_" << stpmod_idx 
<< " = {\n";
@@ -4848,8 +4850,13 @@ dump_unwindsyms (Dwfl_Module *m,
    c->output << ".path = " << lex_cast_qstring (mainfile) << ",\n";

    // PR10228: populate the task_finder_vmcb.
-  if (mainfile[0] == '/') // user-space module
+  if (mainfile[0] == '/') {// user-space module
+      c->output << "#if defined(CONFIG_UTRACE)\n";
        c->output << ".vmcb = & _stp_vmcb_" << stpmod_idx << ",\n";
+      c->output << "#else\n";
+      c->output << ".vmcb = NULL,\n";
+      c->output << "#endif\n";
+  }

    c->output << ".dwarf_module_base = 0x" << hex << base << dec << ", \n";
    c->output << ".eh_frame_addr = 0x" << hex << eh_addr << dec << ", \n";



More information about the Systemtap mailing list