From: Maxim Kokryashkin via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Subject: [Tarantool-patches] [PATCH luajit v6 0/2] memprof: C-symbols resolving Date: Tue, 22 Mar 2022 21:31:23 +0300 [thread overview] Message-ID: <cover.1647972832.git.m.kokryashkin@tarantool.org> (raw) Changes in v6: - Fixed comments as per review by Sergey - Added tests for newly loaded symbols resolution --- >> +#include <stdlib.h> >> +#include <string.h> > > <string.h> and <stdlib.h> are included inside lj_def.h, so this include is excess. Relying on includes in other header files is a terrible practice. Ignoring. >> +-- Parse a single entry in a symtab: .so library >> +local function parse_sym_cfunc(reader, symtab) >> + local addr = reader:read_uleb128() >> + local name = reader:read_string() >> + >> + symtab.cfunc = avl.insert(symtab.cfunc, addr, { >> + name = name >> + }) >> +end > > Side note: Does it sufficient for all 3 cases mentioned above as far as > format is the same? It is obvious that it works for the first two cases so I am going to provide explanation only for the last one. In the last case, symtab contains an addr and a name of a shared library. When allocation occurs in a function from this library, its address is dumped into the event stream. Later on, during the process of resolution, parser searches the name of the function in AVL tree. Since it uses the 'upper_bound' for that, the only match for the mentioned function is the entry for the shared object, from which it was loaded. Maxim Kokryashkin (2): memprof: extend symtab with C-symbols memprof: enrich symtab with newly loaded symbols Makefile.original | 2 +- src/lj_memprof.c | 407 +++++++++++++++++- src/lj_memprof.h | 15 +- test/tarantool-tests/CMakeLists.txt | 1 + .../gh-5813-resolving-of-c-symbols.test.lua | 60 +++ .../CMakeLists.txt | 2 + .../testresolving.c | 19 + test/tarantool-tests/tools-utils-avl.test.lua | 54 +++ tools/CMakeLists.txt | 2 + tools/memprof.lua | 5 + tools/memprof/parse.lua | 19 + tools/utils/avl.lua | 114 +++++ tools/utils/symtab.lua | 27 +- 13 files changed, 715 insertions(+), 12 deletions(-) create mode 100644 test/tarantool-tests/gh-5813-resolving-of-c-symbols.test.lua create mode 100644 test/tarantool-tests/gh-5813-resolving-of-c-symbols/CMakeLists.txt create mode 100644 test/tarantool-tests/gh-5813-resolving-of-c-symbols/testresolving.c create mode 100644 test/tarantool-tests/tools-utils-avl.test.lua create mode 100644 tools/utils/avl.lua -- 2.35.1
next reply other threads:[~2022-03-22 18:31 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-22 18:31 Maxim Kokryashkin via Tarantool-patches [this message] 2022-03-22 18:31 ` [Tarantool-patches] [PATCH luajit v6 1/2] memprof: extend symtab with C-symbols Maxim Kokryashkin via Tarantool-patches 2022-04-04 8:43 ` Sergey Kaplun via Tarantool-patches 2022-04-04 11:34 ` Sergey Kaplun via Tarantool-patches 2022-03-22 18:31 ` [Tarantool-patches] [PATCH luajit v6 2/2] memprof: enrich symtab with newly loaded symbols Maxim Kokryashkin via Tarantool-patches 2022-04-04 8:44 ` Sergey Kaplun via Tarantool-patches 2022-04-04 8:45 ` [Tarantool-patches] [PATCH luajit v6 0/2] memprof: C-symbols resolving Sergey Kaplun via Tarantool-patches 2022-04-22 13:22 ` Igor Munkin via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=cover.1647972832.git.m.kokryashkin@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imun@tarantool.org \ --cc=max.kokryashkin@gmail.com \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit v6 0/2] memprof: C-symbols resolving' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox