Closed idevz closed 8 years ago
@idevz OpenResty enables debuginfo in luajit (and all other components) by default, no special treatment needed (not even --with-debug
). And our gdb tools should work on OpenResty without those special ./configure
options as well.
The No global L located (tried globalL and ngx_cycle)
error is usually a sign of lack of Lua related configurations in your nginx server instance. Are you 100% sure that your nginx worker process you're analyzed is indeed running Lua code?
@idevz Okay, I can reproduce the issue on Mac OS X with the gdb 7.10 installed via homebrew. It works well, however, with gdb 7.9.1 on Fedora Linux with OpenResty 1.9.3.2, according to my test today.
@idevz Okay, I've digged it up and found that there might be problem in this gdb on Mac OS X or the debuginfo in the nginx binary generated by clang there since gdb.lookup_global_symbol("ngx_cycle")
returns None
while the global C variable ngx_cycle
is definitely there:
(gdb) p/x ngx_cycle
$2 = 0x81005250
(gdb) py print(gdb.lookup_global_symbol("ngx_cycle"))
None
For comparsion, on Linux with gdb 7.9.1, we have the following expected:
(gdb) p/x ngx_cycle
$1 = 0x22731b0
(gdb) py print(gdb.lookup_global_symbol("ngx_cycle"))
ngx_cycle
So it looks like a gdb issue. Will you try on Linux or some other OSes instead?
@agentzh thank you very much, I try again with gdb 7.10.1, and it still fail, I will build a Centos VM for testing. thanks again. :+1:
@agentzh thanks for your help, I build up this on my centos vm with gdb-7.10.1 and openresty-1.9.3.2, It's works well.
[root@zc1 src]# gdb -p 17540
GNU gdb (GDB) 7.10.1
Copyright (C) 2015 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-unknown-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".
Attaching to process 17540
Reading symbols from /usr/local/openresty-1.9.3.2/nginx/sbin/nginx...done.
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Reading symbols from /lib64/libcrypt.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/local/openresty-1.9.3.2/luajit/lib/libluajit-5.1.so.2...done.
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Reading symbols from /lib64/libpcre.so.0...(no debugging symbols found)...done.
Reading symbols from /lib64/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Reading symbols from /lib64/libfreebl3.so...(no debugging symbols found)...done.
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.
0x0000003c766e9133 in __epoll_wait_nocancel () from /lib64/libc.so.6
(gdb) lvmst
current VM state: C code (from interpreted Lua code)
(gdb) lgcstat
430 str objects: max=940, avg = 27, min=18, sum=11783
15 upval objects: max=24, avg = 24, min=24, sum=360
1 thread objects: max=496, avg = 496, min=496, sum=496
13 proto objects: max=231, avg = 139, min=80, sum=1815
306 func objects: max=144, avg = 32, min=20, sum=9836
0 trace objects: max=0, avg = 0, min=0, sum=0
0 cdata objects: max=0, avg = 0, min=0, sum=0
65 tab objects: max=3104, avg = 296, min=32, sum=19288
4 udata objects: max=64, avg = 46, min=40, sum=184
sizeof strhash 2048
sizeof g->tmpbuf 128
sizeof ctype_state 0
sizeof jit_state 0
total sz 51170
g->strnum 430, g->gc.total 51170
elapsed: 0.120000 sec
(gdb) p/x ngx_cycle
$1 = 0x223e3b0
(gdb)
:+1:
@idevz Okay, then it looks like a Mac OS X thing.
@agentzh Yes,Thank you very much. :+1: :100:
same issue on centos 6.5 with gdb 7.11 😢
@ssdr Are you using the latest version of OpenResty releases? See
http://openresty.org/en/download.html
Since you provide little details about your gdb output, I guess it's either you are using LuaJIT 2.0 instead of LuaJIT 2.1 (only the latter is supported) and/or your LuaJIT build lacks debug symbols. Better use the OpenResty bundle to avoid such problems.
@agentzh yes, I am using LuaJIT2.0, I'll try LuaJIT2.1, thank you for your reply 😃
I got fail like infos below, When I run any ngx-gdb-cmd in my Mac OSX:
my OSX is 10.11.2 (15C50).
I installed OpenResty with those options:
and
make
like:even though i renew the CCDEBUG option in luajit source code
/Users/zhoujing/Downloads/ngx_openresty-1.9.3.2/bundle/LuaJIT-2.1-20151028/src/Makefile
, I still got fail.here are many info I run in gdb. what should I do to solve this
No global L located (tried globalL and ngx_cycle)
mistake? Thanks every much.(gdb) bt
(gdb) info shared
(gdb) sharedlibrary lib
(gdb) sharedlibrary lib Symbols already loaded for /usr/local/nginx_x/luajit/lib/libluajit-5.1.2.dylib Symbols already loaded for /usr/lib/libSystem.B.dylib Symbols already loaded for /usr/local/lib/libpcre.1.dylib Symbols already loaded for /usr/lib/libz.1.dylib Symbols already loaded for /usr/lib/system/libcache.dylib Symbols already loaded for /usr/lib/system/libcommonCrypto.dylib Symbols already loaded for /usr/lib/system/libcompiler_rt.dylib Symbols already loaded for /usr/lib/system/libcopyfile.dylib Symbols already loaded for /usr/lib/system/libcorecrypto.dylib Symbols already loaded for /usr/lib/system/libdispatch.dylib Symbols already loaded for /usr/lib/system/libdyld.dylib Symbols already loaded for /usr/lib/system/libkeymgr.dylib Symbols already loaded for /usr/lib/system/liblaunch.dylib Symbols already loaded for /usr/lib/system/libmacho.dylib Symbols already loaded for /usr/lib/system/libquarantine.dylib Symbols already loaded for /usr/lib/system/libremovefile.dylib Symbols already loaded for /usr/lib/system/libsystem_asl.dylib Symbols already loaded for /usr/lib/system/libsystem_blocks.dylib Symbols already loaded for /usr/lib/system/libsystem_c.dylib Symbols already loaded for /usr/lib/system/libsystem_configuration.dylib Symbols already loaded for /usr/lib/system/libsystem_coreservices.dylib Symbols already loaded for /usr/lib/system/libsystem_coretls.dylib Symbols already loaded for /usr/lib/system/libsystem_dnssd.dylib Symbols already loaded for /usr/lib/system/libsystem_info.dylib Symbols already loaded for /usr/lib/system/libsystem_kernel.dylib Symbols already loaded for /usr/lib/system/libsystem_m.dylib Symbols already loaded for /usr/lib/system/libsystem_malloc.dylib Symbols already loaded for /usr/lib/system/libsystem_network.dylib Symbols already loaded for /usr/lib/system/libsystem_networkextension.dylib Symbols already loaded for /usr/lib/system/libsystem_notify.dylib Symbols already loaded for /usr/lib/system/libsystem_platform.dylib Symbols already loaded for /usr/lib/system/libsystem_pthread.dylib Symbols already loaded for /usr/lib/system/libsystem_sandbox.dylib Symbols already loaded for /usr/lib/system/libsystem_secinit.dylib Symbols already loaded for /usr/lib/system/libsystem_trace.dylib Symbols already loaded for /usr/lib/system/libunc.dylib Symbols already loaded for /usr/lib/system/libunwind.dylib Symbols already loaded for /usr/lib/system/libxpc.dylib Symbols already loaded for /usr/lib/libobjc.A.dylib Symbols already loaded for /usr/lib/libauto.dylib Symbols already loaded for /usr/lib/libc++abi.dylib Symbols already loaded for /usr/lib/libc++.1.dylib Symbols already loaded for /usr/lib/libDiagnosticMessagesClient.dylib
(gdb) info shared