adsr / phpspy

low-overhead sampling profiler for PHP 7+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning during compilation on Ubunto 20

ljfreelancer88 opened this issue · comments

commented

Using make phpspy_static I got the following warning

cc -std=c90 -Wall -Wextra -pedantic -g -O3  -I. -I./vendor -Ivendor/termbox/  phpspy.c pgrep.c top.c addr_objdump.c event_fout.c event_callgrind.c -o phpspy  -pthread  -Wl,-Bstatic -Lvendor/termbox/ -ltermbox -Wl,-Bdynamic
In file included from phpspy_trace_tpl.c:34,
                 from phpspy.c:804:
phpspy_trace.c: In function ‘copy_zarray_bucket_70’:
phpspy_trace.c:371:27: warning: taking address of packed member of ‘struct _zval_70’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  371 |             hash_bucket = &lbucket->val.u2.next;
      |                           ^~~~~~~~~~~~~~~~~~~~~
In file included from phpspy_trace_tpl.c:34,
                 from phpspy.c:807:
phpspy_trace.c: In function ‘copy_zarray_bucket_71’:
phpspy_trace.c:371:27: warning: taking address of packed member of ‘struct _zval_71’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  371 |             hash_bucket = &lbucket->val.u2.next;
      |                           ^~~~~~~~~~~~~~~~~~~~~
In file included from phpspy_trace_tpl.c:34,
                 from phpspy.c:810:
phpspy_trace.c: In function ‘copy_zarray_bucket_72’:
phpspy_trace.c:371:27: warning: taking address of packed member of ‘struct _zval_72’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  371 |             hash_bucket = &lbucket->val.u2.next;
      |                           ^~~~~~~~~~~~~~~~~~~~~
In file included from phpspy_trace_tpl.c:34,
                 from phpspy.c:813:
phpspy_trace.c: In function ‘copy_zarray_bucket_73’:
phpspy_trace.c:371:27: warning: taking address of packed member of ‘struct _zval_73’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  371 |             hash_bucket = &lbucket->val.u2.next;
      |                           ^~~~~~~~~~~~~~~~~~~~~
In file included from phpspy_trace_tpl.c:34,
                 from phpspy.c:816:
phpspy_trace.c: In function ‘copy_zarray_bucket_74’:
phpspy_trace.c:371:27: warning: taking address of packed member of ‘struct _zval_74’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  371 |             hash_bucket = &lbucket->val.u2.next;
      |                           ^~~~~~~~~~~~~~~~~~~~~
In file included from phpspy_trace_tpl.c:34,
                 from phpspy.c:819:
phpspy_trace.c: In function ‘copy_zarray_bucket_80’:
phpspy_trace.c:371:27: warning: taking address of packed member of ‘struct _zval_80’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  371 |             hash_bucket = &lbucket->val.u2.next;
      |                           ^~~~~~~~~~~~~~~~~~~~~
addr_objdump.c: In function ‘get_php_bin_path’:
addr_objdump.c:34:57: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 233 and 243 [-Wformat-truncation=]
   34 |     snprintf(path_root, PHPSPY_STR_SIZE, "/proc/%d/root/%s", (int)pid, buf);
      |                                                         ^~             ~~~
In file included from /usr/include/stdio.h:867,
                 from phpspy.h:14,
                 from addr_objdump.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 14 and 279 bytes into a destination of size 256
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When using USE_ZEND=1 make. I got the following warning

cc -std=c11 -Wall -Wextra -pedantic -g -O3  -I. -I./vendor $(php-config --includes) -Ivendor/termbox/  -DUSE_ZEND=1 phpspy.c pgrep.c top.c addr_objdump.c event_fout.c event_callgrind.c -o phpspy  -pthread  -Wl,-Bstatic -Lvendor/termbox/ -ltermbox -Wl,-Bdynamic
In file included from phpspy.h:30,
                 from phpspy.c:1:
/usr/include/php/20190902/main/php_config.h:2288: warning: "_GNU_SOURCE" redefined
 2288 | #define _GNU_SOURCE 1
      | 
In file included from phpspy.c:1:
phpspy.h:4: note: this is the location of the previous definition
    4 | #define _GNU_SOURCE
      | 
In file included from phpspy.c:801:
phpspy_trace.c: In function ‘trace_stack’:
phpspy_trace.c:128:70: warning: passing argument 3 of ‘copy_proc_mem’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  128 |                 if (copy_proc_mem(target->pid, "opline", execute_data.opline, &zop, sizeof(zop)) == PHPSPY_OK) {
      |                                                          ~~~~~~~~~~~~^~~~~~~
phpspy.c:685:61: note: expected ‘void *’ but argument is of type ‘const zend_op *’ {aka ‘const struct _zend_op *’}
  685 | static int copy_proc_mem(pid_t pid, const char *what, void *raddr, void *laddr, size_t size) {
      |                                                       ~~~~~~^~~~~
In file included from phpspy.c:801:
phpspy_trace.c: In function ‘trace_memory_info’:
phpspy_trace.c:191:47: warning: unused parameter ‘context’ [-Wunused-parameter]
  191 | static int trace_memory_info(trace_context_t *context) {
      |                              ~~~~~~~~~~~~~~~~~^~~~~~~
At top level:
phpspy.c:711:13: warning: ‘try_get_php_version’ defined but not used [-Wunused-function]
  711 | static void try_get_php_version(trace_target_t *target) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from phpspy.h:30,
                 from pgrep.c:1:
/usr/include/php/20190902/main/php_config.h:2288: warning: "_GNU_SOURCE" redefined
 2288 | #define _GNU_SOURCE 1
      | 
In file included from pgrep.c:1:
phpspy.h:4: note: this is the location of the previous definition
    4 | #define _GNU_SOURCE
      | 
In file included from phpspy.h:30,
                 from top.c:1:
/usr/include/php/20190902/main/php_config.h:2288: warning: "_GNU_SOURCE" redefined
 2288 | #define _GNU_SOURCE 1
      | 
In file included from top.c:1:
phpspy.h:4: note: this is the location of the previous definition
    4 | #define _GNU_SOURCE
      | 
In file included from phpspy.h:30,
                 from addr_objdump.c:1:
/usr/include/php/20190902/main/php_config.h:2288: warning: "_GNU_SOURCE" redefined
 2288 | #define _GNU_SOURCE 1
      | 
In file included from addr_objdump.c:1:
phpspy.h:4: note: this is the location of the previous definition
    4 | #define _GNU_SOURCE
      | 
addr_objdump.c: In function ‘get_php_bin_path’:
addr_objdump.c:34:57: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 233 and 243 [-Wformat-truncation=]
   34 |     snprintf(path_root, PHPSPY_STR_SIZE, "/proc/%d/root/%s", (int)pid, buf);
      |                                                         ^~             ~~~
In file included from /usr/include/stdio.h:867,
                 from phpspy.h:14,
                 from addr_objdump.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 14 and 279 bytes into a destination of size 256
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from phpspy.h:30,
                 from event_fout.c:1:
/usr/include/php/20190902/main/php_config.h:2288: warning: "_GNU_SOURCE" redefined
 2288 | #define _GNU_SOURCE 1
      | 
In file included from event_fout.c:1:
phpspy.h:4: note: this is the location of the previous definition
    4 | #define _GNU_SOURCE
      | 
In file included from phpspy.h:30,
                 from event_callgrind.c:1:
/usr/include/php/20190902/main/php_config.h:2288: warning: "_GNU_SOURCE" redefined
 2288 | #define _GNU_SOURCE 1
      | 
In file included from event_callgrind.c:1:
phpspy.h:4: note: this is the location of the previous definition
    4 | #define _GNU_SOURCE
      |