[root@localhost engine]# gdb /agw/sbin/nginx
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /agw/sbin/nginx...done.
(gdb) set args -c XXXXXX
(gdb) b ngx_http_upload_module.c 3033
Function "ngx_http_upload_module.c 3033" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) b ngx_http_upload_module.c:3033
Breakpoint 1 at 0x53628b: file ./src/upload/ngx_http_upload_module.c, line 3033.
(gdb) r
Starting program: /agw/sbin/nginx -c XXXXXX
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, ngx_http_upload_pass (cf=0x7fffffffdf40, cmd=0x9ce560 <ngx_http_upload_commands>, conf=0xa599a0) at ./src/upload/ngx_http_upload_module.c:3033
3033 ./src/upload/ngx_http_upload_module.c: 没有那个文件或目录.
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-23.el7.x86_64 glibc-2.17-326.el7_9.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-34.el7.x86_64 libcom_err-1.42.9-13.el7.x86_64 libcurl-7.29.0-51.el7.x86_64 libgcc-4.8.5-44.el7.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 libssh2-1.4.3-12.el7.x86_64 nspr-4.19.0-1.el7_5.x86_64 nss-3.36.0-7.el7_5.x86_64 nss-softokn-freebl-3.36.0-5.el7_5.x86_64 nss-util-3.36.0-1.el7_5.x86_64 openldap-2.4.44-20.el7.x86_64 openssl-libs-1.0.2k-16.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-20.el7_9.x86_64
(gdb) bt
#0 ngx_http_upload_pass (cf=0x7fffffffdf40, cmd=0x9ce560 <ngx_http_upload_commands>, conf=0xa599a0) at ./src/upload/ngx_http_upload_module.c:3033
#1 0x000000000046e3eb in ngx_conf_handler (cf=0x7fffffffdf40, last=0) at src/core/ngx_conf_file.c:463
#2 0x000000000046df3f in ngx_conf_parse (cf=0x7fffffffdf40, filename=0x0) at src/core/ngx_conf_file.c:319
#3 0x0000000000504f40 in ngx_http_rewrite_if (cf=0x7fffffffdf40, cmd=0x9c7008 <ngx_http_rewrite_commands+168>, conf=0xa54630)
at src/http/modules/ngx_http_rewrite_module.c:621
#4 0x000000000046e3eb in ngx_conf_handler (cf=0x7fffffffdf40, last=1) at src/core/ngx_conf_file.c:463
#5 0x000000000046df3f in ngx_conf_parse (cf=0x7fffffffdf40, filename=0x0) at src/core/ngx_conf_file.c:319
#6 0x00000000004a89db in ngx_http_core_location (cf=0x7fffffffdf40, cmd=0x9bd738 <ngx_http_core_commands+728>, dummy=0xa50ee0) at src/http/ngx_http_core_module.c:3135
#7 0x000000000046e3eb in ngx_conf_handler (cf=0x7fffffffdf40, last=1) at src/core/ngx_conf_file.c:463
#8 0x000000000046df3f in ngx_conf_parse (cf=0x7fffffffdf40, filename=0x0) at src/core/ngx_conf_file.c:319
#9 0x00000000004a7fd8 in ngx_http_core_server (cf=0x7fffffffdf40, cmd=0x9bd540 <ngx_http_core_commands+224>, dummy=0xa361c0) at src/http/ngx_http_core_module.c:2892
#10 0x000000000046e3eb in ngx_conf_handler (cf=0x7fffffffdf40, last=1) at src/core/ngx_conf_file.c:463
#11 0x000000000046df3f in ngx_conf_parse (cf=0x7fffffffdf40, filename=0x0) at src/core/ngx_conf_file.c:319
#12 0x000000000049f9da in ngx_http_block (cf=0x7fffffffdf40, cmd=0x9bcec0 <ngx_http_commands>, conf=0xa34d60) at src/http/ngx_http.c:239
#13 0x000000000046e3eb in ngx_conf_handler (cf=0x7fffffffdf40, last=1) at src/core/ngx_conf_file.c:463
#14 0x000000000046df3f in ngx_conf_parse (cf=0x7fffffffdf40, filename=0xa33cd8) at src/core/ngx_conf_file.c:319
#15 0x0000000000469f4c in ngx_init_cycle (old_cycle=0x7fffffffe070) at src/core/ngx_cycle.c:284
#16 0x000000000044b157 in main (argc=3, argv=0x7fffffffe418) at src/core/nginx.c:292
(gdb) f 0
#0 ngx_http_upload_pass (cf=0x7fffffffdf40, cmd=0x9ce560 <ngx_http_upload_commands>, conf=0xa599a0) at ./src/upload/ngx_http_upload_module.c:3033
3033 in ./src/upload/ngx_http_upload_module.c
(gdb) info locals
_current_time = 6
_file_name = "/agw/logs/2022-12-07_log_record.log", '\000' <repeats 220 times>
_fp = 0xa53488
__func__ = "ngx_http_upload_pass"
clcf = 0xa58688
ulcf = 0xa599a0
value = 0xa53478
ccv = {cf = 0x6, value = 0xa33a70, complex_value = 0x7fffffffd020, zero = 1, conf_prefix = 0, root_prefix = 1}
(gdb) p (ngx_http_core_loc_conf_t*)clcf
$1 = (ngx_http_core_loc_conf_t *) 0xa58688
(gdb) p (ngx_http_core_loc_conf_t*)clcf->name
$2 = (ngx_http_core_loc_conf_t *) 0x1
(gdb) p (ngx_http_core_loc_conf_t*)clcf->name->data
$3 = (ngx_http_core_loc_conf_t *) 0xa53f79
(gdb) p *(ngx_http_core_loc_conf_t*)clcf->name
Cannot access memory at address 0x1
(gdb) p *(ngx_http_core_loc_conf_t*)clcf
$4 = {name = {len = 1, data = 0xa53f79 "/"}, escaped_name = {len = 1, data = 0xa53f79 "/"}, regex = 0x0, noname = 1, lmt_excpt = 0, named = 0, exact_match = 0, noregex = 0,
auto_redirect = 0, gzip_disable_msie6 = 3, gzip_disable_degradation = 0, static_locations = 0x0, regex_locations = 0x0, loc_conf = 0xa584e8, limit_except = 0,
limit_except_loc_conf = 0x0, handler = 0x530918 <ngx_http_upload_handler>, alias = 0, root = {len = 0, data = 0x0}, post_action = {len = 0, data = 0x0},
root_lengths = 0x0, root_values = 0x0, types = 0x0, types_hash = {buckets = 0x0, size = 0}, default_type = {len = 0, data = 0x0}, client_max_body_size = -1, directio = -1,
directio_alignment = -1, client_body_buffer_size = 18446744073709551615, send_lowat = 18446744073709551615, postpone_output = 18446744073709551615,
sendfile_max_chunk = 18446744073709551615, read_ahead = 18446744073709551615, subrequest_output_buffer_size = 18446744073709551615, limit_rate = 0xffffffffffffffff,
limit_rate_after = 0xffffffffffffffff, client_body_timeout = 18446744073709551615, send_timeout = 18446744073709551615, keepalive_time = 18446744073709551615,
keepalive_timeout = 18446744073709551615, lingering_time = 18446744073709551615, lingering_timeout = 18446744073709551615, resolver_timeout = 18446744073709551615,
auth_delay = 18446744073709551615, resolver = 0x0, keepalive_header = -1, keepalive_requests = 18446744073709551615, keepalive_disable = 0, satisfy = 18446744073709551615,
lingering_close = 18446744073709551615, if_modified_since = 18446744073709551615, max_ranges = 18446744073709551615, client_body_in_file_only = 18446744073709551615,
client_body_in_single_buffer = -1, internal = -1, sendfile = -1, aio = -1, aio_write = -1, tcp_nopush = -1, tcp_nodelay = -1, reset_timedout_connection = -1,
absolute_redirect = -1, server_name_in_redirect = -1, port_in_redirect = -1, msie_padding = -1, msie_refresh = -1, log_not_found = -1, log_subrequest = -1,
recursive_error_pages = -1, server_tokens = 18446744073709551615, chunked_transfer_encoding = -1, etag = -1, gzip_vary = -1, gzip_http_version = 18446744073709551615,
gzip_proxied = 0, gzip_disable = 0xffffffffffffffff, thread_pool = 0xffffffffffffffff, thread_pool_value = 0xffffffffffffffff, disable_symlinks = 18446744073709551615,
disable_symlinks_from = 0xffffffffffffffff, error_pages = 0x0, client_body_temp_path = 0x0, open_file_cache = 0xffffffffffffffff, open_file_cache_valid = -1,
open_file_cache_min_uses = 18446744073709551615, open_file_cache_errors = -1, open_file_cache_events = -1, error_log = 0x0, types_hash_max_size = 18446744073709551615,
types_hash_bucket_size = 18446744073709551615, locations = 0x0}
(gdb) p *(ngx_http_upload_loc_conf_t*)ulcf
$5 = {url = {len = 5, data = 0xa59ed4 "@test"}, url_cv = 0x0, state_store_path = 0x0, store_path = 0x0, store_access = 18446744073709551615,
buffer_size = 18446744073709551615, merge_buffer_size = 18446744073709551615, range_header_buffer_size = 18446744073709551615, max_header_len = 18446744073709551615,
max_output_body_len = 18446744073709551615, max_file_size = -1, field_templates = 0x0, aggregate_field_templates = 0x0, field_filters = 0x0, cleanup_statuses = 0x0,
header_templates = 0x0, forward_args = -1, tame_arrays = -1, resumable_uploads = -1, empty_field_names = -1, limit_rate = 18446744073709551615, md5 = 0, sha1 = 0,
sha256 = 0, sha512 = 0, crc32 = 0}
(gdb) p ngx_http_script_variables_count(&value[1]
A syntax error in expression, near `'.
(gdb) p ngx_http_script_variables_count(&value[1])
$6 = 0
(gdb) p ulcf->url
$7 = {len = 5, data = 0xa59ed4 "@test"}
(gdb) call ngx_http_upload_handler
$8 = {ngx_int_t (ngx_http_request_t *)} 0x530918 <ngx_http_upload_handler>
(gdb) p clcf->handler
$9 = (ngx_http_handler_pt) 0x530918 <ngx_http_upload_handler>
(gdb) quit
A debugging session is active.
Inferior 1 [process 20477] will be killed.
Quit anyway? (y or n) y
nginx的模块调试记录
于 2022-12-07 20:39:10 首次发布