Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-29568

libelf (specificly libdw) based stack resolver

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Server
    • None

    Description

      Part of libelf, though packages as libdw (at least in debian). This is the newer version on bfd for stack resolution.

      From source; https://sourceware.org/elfutils/, "The libraries and backends are dual GPLv2+/LGPLv3+. The utilities are GPLv3+", so staying with the libraries will mean there isn't non-distributable option.

      init

         static char *debuginfo_path;
        static const Dwfl_Callbacks proc_callbacks =
            {
            .find_debuginfo = dwfl_standard_find_debuginfo,
              .debuginfo_path = &debuginfo_path,
        
            .find_elf = dwfl_linux_proc_find_elf,
            };
        Dwfl *dwfl = dwfl_begin (&proc_callbacks);
        if (dwfl == NULL)
          error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1));
      

        int result = dwfl_linux_proc_report (dwfl, pid); // prints maps
        result = dwfl_linux_proc_attach (dwfl, pid, true); // other option?, there where thread based attaches
      

      Resolution; example addr2line.

      Dwfl_Module *mod = dwfl_addrmodule (dwfl, addr);
       Dwfl_Line *line = dwfl_module_getsrc (mod, addr);
      src = dwfl_lineinfo (line, &addr, &lineno, &linecol,   NULL, NULL)
      

      Using libelf, this integrates with debuginfod (when we run a service), or just rely on distro.

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              danblack Daniel Black
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.