Community
Participate
Working Groups
in get_symbol_name() function, in agent/tcf/services/symbols_elf.c file, since the sym_info.name is NULL which returned by the unpack_elf_symbol_info( ..., &sym_info) function at 3330 line, that causes the tcf-server crashed at 3332 line. I try to fix it as following, tcf.agent$ git diff agent/tcf/services/symbols_elf.c diff --git a/agent/tcf/services/symbols_elf.c b/agent/tcf/services/symbols_elf.c index 07049f7..be4f3b4 100644 --- a/agent/tcf/services/symbols_elf.c +++ b/agent/tcf/services/symbols_elf.c @@ -3328,7 +3328,8 @@ int get_symbol_name(const Symbol * sym, char ** name) { if (sym->dimension == 0) { size_t i; unpack_elf_symbol_info(sym->tbl, sym->index, &sym_info); - for (i = 0;; i++) { + for (i = 0; i < sym->tbl->sym_count; i++) { + if (!sym_info.name) break; if (sym_info.name[i] == 0) { *name = sym_info.name; break;
the test source code: /* includes */ #include <stdio.h> #include <stdlib.h> int main ( int argc, /* number of arguments */ char * argv[] /* array of arguments */ ) { int nbRtp = atoi (argv[1]); printf("nbRtp = %d\n", nbRtp); return 0; }
Created attachment 283210 [details] binary file
in my test, if I step return as following stack trace, this issue will happen. iRv64_rtp_nodbg (Step Over) _Stoulx() 0x00000000040014dc main() at rtp.c:10 0x00000000040003ec _start() 0x00000000040001a0
Fixed. Thanks!