Summary: | Collection fails when built without java support: symbol lookup error: ...-binutils-2.39/bin/../lib/gprofng/libgp-collector.so: undefined symbol: __collector_jprofile_start_attach | ||
---|---|---|---|
Product: | binutils | Reporter: | Sergei Trofimovich <slyich> |
Component: | gprofng | Assignee: | Vladimir Mezentsev <vladimir.mezentsev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | herrtimson, sam |
Priority: | P2 | ||
Version: | 2.39 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | 2022-08-13 00:00:00 |
Description
Sergei Trofimovich
2022-08-12 09:21:08 UTC
So far I worked it around locally by removing java-specific code in libcollector: --- a/gprofng/libcollector/collector.c +++ b/gprofng/libcollector/collector.c @@ -912,9 +912,11 @@ __collector_open_experiment (const char *exp, const char *params, sp_origin_t or /* init tsd for unwind, called right after __collector_tsd_allocate()*/ __collector_ext_unwind_key_init (1, NULL); +#if defined(GPROFNG_JAVA_PROFILING) /* start java attach if suitable */ if (exp_origin == SP_ORIGIN_DBX_ATTACH) __collector_jprofile_start_attach (); +#endif start_sec_time = CALL_UTIL (time)(NULL); __collector_start_time = collector_interface.getHiResTime (); TprintfT (DBG_LT0, "\t__collector_open_experiment; resetting start_time\n"); --- a/gprofng/libcollector/unwind.c +++ b/gprofng/libcollector/unwind.c @@ -557,6 +557,7 @@ __collector_get_frame_info (hrtime_t ts, int mode, void *arg) int size = max_frame_size; #define MIN(a,b) ((a)<(b)?(a):(b)) +#if defined(GPROFNG_JAVA_PROFILING) /* get Java info */ if (__collector_java_mode && __collector_java_asyncgetcalltrace_loaded && context && !pseudo_context) { @@ -569,6 +570,7 @@ __collector_get_frame_info (hrtime_t ts, int mode, void *arg) size -= sz; } } +#endif /* get native stack */ if (context) Is it a reasonable approach? Or should jprofile.c unconditionally define those functions? Say, with a possible no-op when `javac` is not available. What would be your preference? Thanks for catching this. My ol8 and ol9 are not reporting anything. % gprofng collect app $(which ls) Creating experiment directory test.1.er (Process ID: 155186) ... acinclude.m4 common configure doc libcollector Makefile.in src testsuite aclocal.m4 config configure.ac gp-display-html Makefile.am README test.1.er These functions are undefined (but never called): % nm lib/gprofng/libgp-collector.so | egrep '__collector_jprofile_start_attach|__collector_ext_jstack_unwind' U __collector_ext_jstack_unwind U __collector_jprofile_start_attach I will push your fix to the master branch. The master branch has been updated by Vladimir Mezentsev <vmezents@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=49ddd814ac1071af7c4f45d5f8398b91862f2c7f commit 49ddd814ac1071af7c4f45d5f8398b91862f2c7f Author: Vladimir Mezentsev <vladimir.mezentsev@oracle.com> Date: Wed Aug 17 19:55:23 2022 -0700 gprofng: fix bug 29479 Collection fails when built without java support gprofng/ChangeLog 2022-08-17 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29479 * libcollector/collector.c: Add #if defined(GPROFNG_JAVA_PROFILING) for java specific code. * libcollector/unwind.c: Likewise. Fixed in the master branch. |