Closed coolg92003 closed 5 months ago
@KBaichoo has been looking at debug symbol related things recently and may have some insight.
Hi @KBaichoo , Would you share some idea on this? Thanks in advance! Cliff
The major concern is that it can't show the content of *this
See my PR here: https://github.com/envoyproxy/envoy/pull/33942 for a brief overview on some debug symbols related stuff.
I'd check that the section being referenced exists. Also what version of clang / gcc are you using? Likewise with gdb ?
I've ran into some issues of using newer toolchains with older gdb versions.
hi @KBaichoo ,
Really Appreciated your reply! in our build container(ubuntu), I didn't find clang and see below for gdb and gcc version:
gdb --version
GNU gdb (Ubuntu 10.2-0ubuntu1~20.04~1) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
gcc --version
gcc (Ubuntu 11.4.0-2ubuntu1~20.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
BTW, which version of gdb and gcc works for you? I mean that it can read *this in gdb for envoy built by "-c dbg" thanks, Cliff
neither of those versions look too old.
I actually build with clang 14 (which is what CI is using) and use gdb GNU gdb (GDB) 14.2
. I know some other folks have tried use lldb
when debugging and run into issues using gdb.
FWIW I'm able to get the value printed as expected following your experiment:
Thread 8 "wrk:worker_0" hit Breakpoint 1, Envoy::Network::ConnectionImpl::onRead (this=0x26a0bd3f6000, read_buffer_size=79)
at source/common/network/connection_impl.cc:357
357 ASSERT(dispatcher_.isThreadSafe());
(gdb) p this->read_end_stream_
$1 = false
And these are the segments I have from in the debug build:
[11:16:27] kbaichoo:envoy:0 $size --format=SysV bazel-bin/source/exe/envoy-static
bazel-bin/source/exe/envoy-static :
section size addr
.interp 28 736
.note.ABI-tag 32 764
.note.gnu.build-id 36 796
.dynsym 14088 832
.gnu.version 1174 14920
.gnu.version_r 560 16096
.gnu.hash 1396 16656
.dynstr 7286 18052
.rela.dyn 7981248 25344
.rela.plt 9600 8006592
.rodata 9880792 8019968
.gcc_except_table 2210936 17900760
protodesc_cold 581552 20111696
flags_help_cold 5452 20693248
.eh_frame_hdr 8443644 20698700
.eh_frame 34644932 29142344
.text 97679155 63791424
.init 27 161470580
.fini 13 161470608
google_malloc 815665 161470656
malloc_hook 553 162286322
.plt 6416 162286880
.tdata 192 162297408
.tbss 9581 162297600
.fini_array 8 162297600
.init_array 17320 162297608
.data.rel.ro 2895800 162314928
.dynamic 512 165210728
.got 296 165211240
.got.plt 3224 165211536
.data 381560 165218880
.tm_clone_table 0 165600440
__rseq_cs 2624 165600448
__rseq_cs_ptr_array 656 165603072
.bss 10189248 165603776
.comment 97 0
.debug_abbrev 245791 0
.debug_info 2565679 0
.debug_str_offsets 580120 0
.debug_str 668320 0
.debug_addr 60972824 0
.debug_line 363996157 0
.debug_line_str 497779 0
.debug_rnglists 27153314 0
.debug_loclists 445938 0
.debug_aranges 1056 0
.debug_frame 96 0
.gdb_index 382380659 0
Total 1015293436
In bazel-bin I have the following:
[11:18:37] kbaichoo:bazel-bin:0 $find . -name *.dwp
[11:18:41] kbaichoo:bazel-bin:0 $find . -name *.dwo
./external/com_github_alibaba_hessian2_codec/hessian2/_objs/codec_impl_lib/codec.pic.dwo
./external/com_github_alibaba_hessian2_codec/hessian2/_objs/reader_lib/reader.pic.dwo
./external/com_github_alibaba_hessian2_codec/hessian2/basic_codec/_objs/byte_codec_lib/byte_codec.pic.dwo
...
No dwp
files but many dwo
.
Congratulations! I still can't print *this thanks Cliff
hi @KBaichoo , After building by below command, then gdb can show everything
cd /source; export PATH CC=clang CXX=clang++ && bazel build --define tcmalloc=debug -c dbg --copt=-Wno-unknown-warning-option --copt=-Wno-unused-but-set-variable --cxxopt=-Wno-unknown-warning-option --cxxopt=-Wno-unused-but-set-variable //source/exe:envoy
hope it help! Cliff
when I build envoy by "-c dbg", then run by gdb and try to check variable value and get below info
anything or path missed? and check below for details: 1) build cd /source; export PATH bazel build -c dbg //source/exe:envoy 2) run gdb /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/ba zel-out/k8-dbg/bin/source/exe/envoy-static b ConnectionImpl::onRead run -l trace --concurrency 1 -c /tmp/sesDySecLCnoDEnvoy.yaml --log-path /tmp/envoy.log 3) trigger message 4) check variable p this->read_endstream DW_FORM_strp pointing outside of .debug_str section [in module /build/.cache/bazel/_bazel_envoybuild/b570b5ccd0454dc9af9f65ab1833764d/execroot/envoy/bazel-out/k8-dbg/bin/source/exe/envoy-static]
thanks Cliff