openresty / openresty-gdb-utils

GDB Utilities for OpenResty (including Nginx, ngx_lua, LuaJIT, and more)
335 stars 89 forks source link

Trying to format a gdb.Value instead of an integer #18

Open erikcw opened 6 years ago

erikcw commented 6 years ago
root@ip-172-30-5-125:/opt/openresty/nginx/conf/openresty-gdb-utils# gdb /usr/local/openresty/nginx/sbin/nginx 1627
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/openresty/nginx/sbin/nginx...Reading symbols from /usr/lib/debug/.build-id/b5/26715423f8887c0f43fee5f6f92ad9de516f34.debug...d
one.
done.
Attaching to program: /usr/local/openresty/nginx/sbin/nginx, process 1627
Reading symbols from /lib/x86_64-linux-gnu/libdl.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libdl-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...Reading symbols from /usr/lib/debug/.build-id/ce/17e023542265fc11d9bc8f534bb4f070493d30.debug...d
one.
done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Reading symbols from /lib/x86_64-linux-gnu/libcrypt.so.1...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libcrypt-2.23.so...done.
done.
Reading symbols from /usr/local/openresty/luajit/lib/libluajit-5.1.so.2...Reading symbols from /usr/lib/debug/.build-id/e1/a0df4f3cc077937317d3ec0db79f2811d97
bff.debug...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libm-2.23.so...done.
done.
Reading symbols from /usr/local/openresty/pcre/lib/libpcre.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/local/openresty/openssl/lib/libssl.so.1.0.0...(no debugging symbols found)...done.
Reading symbols from /usr/local/openresty/openssl/lib/libcrypto.so.1.0.0...(no debugging symbols found)...done.
Reading symbols from /usr/local/openresty/zlib/lib/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.23.so...done.
done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_files.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_files-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_dns.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_dns-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libresolv.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libresolv-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_compat.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_compat-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnsl.so.1...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnsl-2.23.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_nis.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_nis-2.23.so...done.
done.
Reading symbols from /usr/local/lib/lua/5.1/lpeg.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/lua/5.1/socket/core.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/openresty/lualib/cjson.so...Reading symbols from /usr/lib/debug/.build-id/17/db0c5d68ca313173ac7e4a323550c7ca9af932.debug...d$ne.
done.
Reading symbols from /usr/local/lib/lua/5.1/crypto.so...(no debugging symbols found)...done.
0x00007f675858f9f3 in __epoll_wait_nocancel () at ../sysdeps/unix/syscall-template.S:84
84      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) source luajit21.py
(gdb) lgcpath 100000 tab
path 000:[registry] ->Tab["tcp{client}"] ->Tab["__index"] ->Tab["send"] ->cfunc ->env ->Tab["loaded"] ->Tab["lapis"] ->Tab["app_cache"] ->Tab Traceback (most recent call last):
  File "luajit21.py", line 2720, in invoke
    self.visit_tval(g['registrytv'], g)
  File "luajit21.py", line 2977, in visit_tval
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2958, in dfs
    self.visit_tab(obj['tab'].address, g)
  File "luajit21.py", line 3047, in visit_tab
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2958, in dfs
    self.visit_tab(obj['tab'].address, g)
  File "luajit21.py", line 3047, in visit_tab
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2958, in dfs
    self.visit_tab(obj['tab'].address, g)
  File "luajit21.py", line 3047, in visit_tab
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2960, in dfs
    self.visit_func(obj['fn'].address, g)
  File "luajit21.py", line 3070, in visit_func
    self.dfs(tabref(fn['c']['env']), g)
  File "luajit21.py", line 2958, in dfs
    self.visit_tab(obj['tab'].address, g)
  File "luajit21.py", line 3047, in visit_tab
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2958, in dfs
    self.visit_tab(obj['tab'].address, g)
  File "luajit21.py", line 3047, in visit_tab
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2958, in dfs
    self.visit_tab(obj['tab'].address, g)
  File "luajit21.py", line 3047, in visit_tab
    self.dfs(gcval(tv), g)
  File "luajit21.py", line 2952, in dfs
    self.print_obj_path(g)
  File "luajit21.py", line 2918, in print_obj_path
    out("sz:%d (GCobj*)%#x ->END\n" % (sz, gco))
TypeError: %x format: an integer is required, not gdb.Value

Error occurred in Python command: %x format: an integer is required, not gdb.Value
spacewander commented 6 years ago

@erikcw Just provide a quick fix for the issue. Could you try it out?

erikcw commented 6 years ago

@spacewander Seems to fix the issue:

(gdb) lgcpath 100000 tab
path 000:[registry] ->Tab["tcp{client}"] ->Tab["__index"] ->Tab["send"] ->cfunc ->env ->Tab["loaded"] ->Tab["lapis"] ->Tab["app_cache"] ->Tab sz:786464 (GCobj*)0x41415e18 ->END

Thanks!