LCOV - code coverage report
Current view: top level - libdwfl - dwfl_frame.c (source / functions) Hit Total Coverage
Test: elfutils-0.193 Lines: 141 227 62.1 %
Date: 2025-05-08 22:59:09 Functions: 13 17 76.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 60 128 46.9 %

           Branch data     Line data    Source code
       1                 :            : /* Get Dwarf Frame state for target PID or core file.
       2                 :            :    Copyright (C) 2013, 2014, 2024-2025 Red Hat, Inc.
       3                 :            :    This file is part of elfutils.
       4                 :            : 
       5                 :            :    This file is free software; you can redistribute it and/or modify
       6                 :            :    it under the terms of either
       7                 :            : 
       8                 :            :      * the GNU Lesser General Public License as published by the Free
       9                 :            :        Software Foundation; either version 3 of the License, or (at
      10                 :            :        your option) any later version
      11                 :            : 
      12                 :            :    or
      13                 :            : 
      14                 :            :      * the GNU General Public License as published by the Free
      15                 :            :        Software Foundation; either version 2 of the License, or (at
      16                 :            :        your option) any later version
      17                 :            : 
      18                 :            :    or both in parallel, as here.
      19                 :            : 
      20                 :            :    elfutils is distributed in the hope that it will be useful, but
      21                 :            :    WITHOUT ANY WARRANTY; without even the implied warranty of
      22                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23                 :            :    General Public License for more details.
      24                 :            : 
      25                 :            :    You should have received copies of the GNU General Public License and
      26                 :            :    the GNU Lesser General Public License along with this program.  If
      27                 :            :    not, see <http://www.gnu.org/licenses/>.  */
      28                 :            : 
      29                 :            : #ifdef HAVE_CONFIG_H
      30                 :            : # include <config.h>
      31                 :            : #endif
      32                 :            : 
      33                 :            : #include <system.h>
      34                 :            : 
      35                 :            : #include "libdwflP.h"
      36                 :            : #include "libdwfl_stacktraceP.h"
      37                 :            : 
      38                 :            : /* Set STATE->pc_set from STATE->regs according to the backend.  Return true on
      39                 :            :    success, false on error.  */
      40                 :            : static bool
      41                 :         86 : state_fetch_pc (Dwfl_Frame *state)
      42                 :            : {
      43   [ -  +  -  + ]:         86 :   switch (state->pc_state)
      44                 :            :     {
      45                 :            :     case DWFL_FRAME_STATE_PC_SET:
      46                 :            :       return true;
      47                 :          0 :     case DWFL_FRAME_STATE_PC_UNDEFINED:
      48                 :          0 :       abort ();
      49                 :         56 :     case DWFL_FRAME_STATE_ERROR:
      50                 :            :       {
      51                 :         56 :         Ebl *ebl = state->thread->process->ebl;
      52                 :         56 :         Dwarf_CIE abi_info;
      53         [ -  + ]:         56 :         if (ebl_abi_cfi (ebl, &abi_info) != 0)
      54                 :            :           {
      55                 :          0 :             __libdwfl_seterrno (DWFL_E_LIBEBL);
      56                 :          0 :             return false;
      57                 :            :           }
      58                 :         56 :         unsigned ra = abi_info.return_address_register;
      59                 :            :         /* dwarf_frame_state_reg_is_set is not applied here.  */
      60         [ -  + ]:         56 :         if (ra >= ebl_frame_nregs (ebl))
      61                 :            :           {
      62                 :          0 :             __libdwfl_seterrno (DWFL_E_LIBEBL_BAD);
      63                 :          0 :             return false;
      64                 :            :           }
      65                 :         56 :         state->pc = state->regs[ra] + ebl_ra_offset (ebl);
      66                 :         56 :         state->pc_state = DWFL_FRAME_STATE_PC_SET;
      67                 :            :       }
      68                 :         56 :       return true;
      69                 :            :     }
      70                 :          0 :   abort ();
      71                 :            : }
      72                 :            : 
      73                 :            : /* Do not call it on your own, to be used by thread_* functions only.  */
      74                 :            : 
      75                 :            : static void
      76                 :          0 : free_states (Dwfl_Frame *state)
      77                 :            : {
      78   [ -  -  -  -  :        146 :   while (state)
          +  +  -  +  +  
                      + ]
      79                 :            :     {
      80                 :         62 :       Dwfl_Frame *next = state->unwound;
      81                 :         62 :       free(state);
      82                 :         62 :       state = next;
      83                 :            :     }
      84                 :            : }
      85                 :            : 
      86                 :            : static Dwfl_Frame *
      87                 :         86 : state_alloc (Dwfl_Thread *thread)
      88                 :            : {
      89         [ -  + ]:         86 :   assert (thread->unwound == NULL);
      90                 :         86 :   Ebl *ebl = thread->process->ebl;
      91                 :         86 :   size_t nregs = ebl_frame_nregs (ebl);
      92         [ -  + ]:         86 :   if (nregs == 0)
      93                 :            :     return NULL;
      94         [ -  + ]:         86 :   assert (nregs < sizeof (((Dwfl_Frame *) NULL)->regs_set) * 8);
      95                 :         86 :   Dwfl_Frame *state = malloc (sizeof (*state) + sizeof (*state->regs) * nregs);
      96         [ -  + ]:         86 :   if (state == NULL)
      97                 :            :     return NULL;
      98                 :         86 :   state->thread = thread;
      99                 :         86 :   state->signal_frame = false;
     100                 :         86 :   state->initial_frame = true;
     101                 :         86 :   state->pc_state = DWFL_FRAME_STATE_ERROR;
     102                 :         86 :   state->unwound_source = DWFL_UNWOUND_INITIAL_FRAME;
     103                 :         86 :   memset (state->regs_set, 0, sizeof (state->regs_set));
     104                 :         86 :   thread->unwound = state;
     105                 :         86 :   state->unwound = NULL;
     106                 :         86 :   return state;
     107                 :            : }
     108                 :            : 
     109                 :            : void
     110                 :            : internal_function
     111                 :        102 : __libdwfl_process_free (Dwfl_Process *process)
     112                 :            : {
     113                 :        102 :   Dwfl *dwfl = process->dwfl;
     114         [ +  + ]:        102 :   if (process->callbacks->detach != NULL)
     115                 :        100 :     process->callbacks->detach (dwfl, process->callbacks_arg);
     116         [ -  + ]:        102 :   assert (dwfl->process == process);
     117                 :        102 :   dwfl->process = NULL;
     118         [ +  + ]:        102 :   if (process->ebl_close)
     119                 :        100 :     ebl_closebackend (process->ebl);
     120                 :        102 :   free (process);
     121                 :        102 :   dwfl->attacherr = DWFL_E_NOERROR;
     122                 :        102 : }
     123                 :            : 
     124                 :            : /* Allocate new Dwfl_Process for DWFL.  */
     125                 :            : static void
     126                 :        104 : process_alloc (Dwfl *dwfl)
     127                 :            : {
     128                 :        104 :   Dwfl_Process *process = malloc (sizeof (*process));
     129         [ +  - ]:        104 :   if (process == NULL)
     130                 :            :     return;
     131                 :        104 :   process->dwfl = dwfl;
     132                 :        104 :   dwfl->process = process;
     133                 :            : }
     134                 :            : 
     135                 :            : bool
     136                 :        104 : dwfl_attach_state (Dwfl *dwfl, Elf *elf, pid_t pid,
     137                 :            :                    const Dwfl_Thread_Callbacks *thread_callbacks, void *arg)
     138                 :            : {
     139         [ -  + ]:        104 :   if (dwfl->process != NULL)
     140                 :            :     {
     141                 :          0 :       __libdwfl_seterrno (DWFL_E_ATTACH_STATE_CONFLICT);
     142                 :          0 :       return false;
     143                 :            :     }
     144                 :            : 
     145                 :            :   /* Reset any previous error, we are just going to try again.  */
     146                 :        104 :   dwfl->attacherr = DWFL_E_NOERROR;
     147                 :            :   /* thread_callbacks is declared NN */
     148         [ +  - ]:        104 :   if (thread_callbacks->next_thread == NULL
     149         [ -  + ]:        104 :       || thread_callbacks->set_initial_registers == NULL)
     150                 :            :     {
     151                 :          0 :       dwfl->attacherr = DWFL_E_INVALID_ARGUMENT;
     152                 :          0 :     fail:
     153                 :          0 :       dwfl->attacherr = __libdwfl_canon_error (dwfl->attacherr);
     154                 :          0 :       __libdwfl_seterrno (dwfl->attacherr);
     155                 :          0 :       return false;
     156                 :            :     }
     157                 :            : 
     158                 :        104 :   Ebl *ebl;
     159                 :        104 :   bool ebl_close;
     160         [ +  + ]:        104 :   if (elf != NULL)
     161                 :            :     {
     162                 :        102 :       ebl = ebl_openbackend (elf);
     163                 :        102 :       ebl_close = true;
     164                 :            :     }
     165                 :            :   else
     166                 :            :     {
     167                 :          2 :       ebl = NULL;
     168         [ +  - ]:          2 :       for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL; mod = mod->next)
     169                 :            :         {
     170                 :            :           /* Reading of the vDSO or (deleted) modules may fail as
     171                 :            :              /proc/PID/mem is unreadable without PTRACE_ATTACH and
     172                 :            :              we may not be PTRACE_ATTACH-ed now.  MOD would not be
     173                 :            :              re-read later to unwind it when we are already
     174                 :            :              PTRACE_ATTACH-ed to PID.  This happens when this function
     175                 :            :              is called from dwfl_linux_proc_attach with elf == NULL.
     176                 :            :              __libdwfl_module_getebl will call __libdwfl_getelf which
     177                 :            :              will call the find_elf callback.  */
     178         [ +  - ]:          2 :           if (startswith (mod->name, "[vdso: ")
     179   [ +  -  -  + ]:          4 :               || strcmp (strrchr (mod->name, ' ') ?: "",
     180                 :            :                          " (deleted)") == 0)
     181                 :          0 :             continue;
     182                 :          2 :           Dwfl_Error error = __libdwfl_module_getebl (mod);
     183         [ -  + ]:          2 :           if (error != DWFL_E_NOERROR)
     184                 :          0 :             continue;
     185                 :          2 :           ebl = mod->ebl;
     186                 :          2 :           break;
     187                 :            :         }
     188                 :            :       ebl_close = false;
     189                 :            :     }
     190         [ -  + ]:        104 :   if (ebl == NULL)
     191                 :            :     {
     192                 :            :       /* Not identified EBL from any of the modules.  */
     193                 :          0 :       dwfl->attacherr = DWFL_E_PROCESS_NO_ARCH;
     194                 :          0 :       goto fail;
     195                 :            :     }
     196                 :        104 :   process_alloc (dwfl);
     197                 :        104 :   Dwfl_Process *process = dwfl->process;
     198         [ -  + ]:        104 :   if (process == NULL)
     199                 :            :     {
     200         [ #  # ]:          0 :       if (ebl_close)
     201                 :          0 :         ebl_closebackend (ebl);
     202                 :          0 :       dwfl->attacherr = DWFL_E_NOMEM;
     203                 :          0 :       goto fail;
     204                 :            :     }
     205                 :        104 :   process->ebl = ebl;
     206                 :        104 :   process->ebl_close = ebl_close;
     207                 :        104 :   process->pid = pid;
     208                 :        104 :   process->callbacks = thread_callbacks;
     209                 :        104 :   process->callbacks_arg = arg;
     210                 :            : 
     211         [ -  + ]:        104 :   if (dwfl->tracker != NULL)
     212                 :          0 :     __libdwfl_stacktrace_add_dwfl_to_tracker (dwfl);
     213                 :            : 
     214                 :            :   return true;
     215                 :            : }
     216                 :            : INTDEF(dwfl_attach_state)
     217                 :            : 
     218                 :            : pid_t
     219                 :        138 : dwfl_pid (Dwfl *dwfl)
     220                 :            : {
     221         [ -  + ]:        138 :   if (dwfl->attacherr != DWFL_E_NOERROR)
     222                 :            :     {
     223                 :          0 :       __libdwfl_seterrno (dwfl->attacherr);
     224                 :          0 :       return -1;
     225                 :            :     }
     226                 :            : 
     227         [ -  + ]:        138 :   if (dwfl->process == NULL)
     228                 :            :     {
     229                 :          0 :       __libdwfl_seterrno (DWFL_E_NO_ATTACH_STATE);
     230                 :          0 :       return -1;
     231                 :            :     }
     232                 :        138 :   return dwfl->process->pid;
     233                 :            : }
     234                 :            : INTDEF(dwfl_pid)
     235                 :            : 
     236                 :            : Dwfl *
     237                 :        332 : dwfl_thread_dwfl (Dwfl_Thread *thread)
     238                 :            : {
     239                 :        332 :   return thread->process->dwfl;
     240                 :            : }
     241                 :            : INTDEF(dwfl_thread_dwfl)
     242                 :            : 
     243                 :            : pid_t
     244                 :        484 : dwfl_thread_tid (Dwfl_Thread *thread)
     245                 :            : {
     246                 :        484 :   return thread->tid;
     247                 :            : }
     248                 :            : INTDEF(dwfl_thread_tid)
     249                 :            : 
     250                 :            : Dwfl_Thread *
     251                 :        330 : dwfl_frame_thread (Dwfl_Frame *state)
     252                 :            : {
     253                 :        330 :   return state->thread;
     254                 :            : }
     255                 :            : INTDEF(dwfl_frame_thread)
     256                 :            : 
     257                 :            : Dwfl_Unwound_Source
     258                 :         98 : dwfl_frame_unwound_source (Dwfl_Frame *state)
     259                 :            : {
     260                 :         98 :   return state->unwound_source;
     261                 :            : }
     262                 :            : INTDEF(dwfl_frame_unwound_source)
     263                 :            : 
     264                 :            : const char *
     265                 :         88 : dwfl_unwound_source_str (Dwfl_Unwound_Source unwound_source)
     266                 :            : {
     267   [ +  +  -  -  :         88 :   switch (unwound_source)
                   -  - ]
     268                 :            :     {
     269                 :            :     case DWFL_UNWOUND_NONE:
     270                 :            :       return "none";
     271                 :         30 :     case DWFL_UNWOUND_INITIAL_FRAME:
     272                 :         30 :       return "initial";
     273                 :         58 :     case DWFL_UNWOUND_EH_CFI:
     274                 :         58 :       return "eh_frame";
     275                 :          0 :     case DWFL_UNWOUND_DWARF_CFI:
     276                 :          0 :       return "dwarf";
     277                 :          0 :     case DWFL_UNWOUND_EBL:
     278                 :          0 :       return "ebl";
     279                 :          0 :     default:
     280                 :          0 :       return "unknown";
     281                 :            :     }
     282                 :            : }
     283                 :            : INTDEF(dwfl_unwound_source_str)
     284                 :            : 
     285                 :            : int
     286                 :         62 : dwfl_getthreads (Dwfl *dwfl, int (*callback) (Dwfl_Thread *thread, void *arg),
     287                 :            :                  void *arg)
     288                 :            : {
     289         [ -  + ]:         62 :   if (dwfl->attacherr != DWFL_E_NOERROR)
     290                 :            :     {
     291                 :          0 :       __libdwfl_seterrno (dwfl->attacherr);
     292                 :          0 :       return -1;
     293                 :            :     }
     294                 :            : 
     295                 :         62 :   Dwfl_Process *process = dwfl->process;
     296         [ -  + ]:         62 :   if (process == NULL)
     297                 :            :     {
     298                 :          0 :       __libdwfl_seterrno (DWFL_E_NO_ATTACH_STATE);
     299                 :          0 :       return -1;
     300                 :            :     }
     301                 :            : 
     302                 :         62 :   Dwfl_Thread thread;
     303                 :         62 :   thread.process = process;
     304                 :         62 :   thread.unwound = NULL;
     305                 :         62 :   thread.callbacks_arg = NULL;
     306                 :         62 :   thread.aarch64.pauth_insn_mask = 0;
     307                 :            : 
     308                 :        152 :   for (;;)
     309                 :            :     {
     310                 :        152 :       thread.tid = process->callbacks->next_thread (dwfl,
     311                 :            :                                                     process->callbacks_arg,
     312                 :            :                                                     &thread.callbacks_arg);
     313         [ +  - ]:        152 :       if (thread.tid < 0)
     314                 :            :         return -1;
     315         [ +  + ]:        152 :       if (thread.tid == 0)
     316                 :            :         {
     317                 :         60 :           __libdwfl_seterrno (DWFL_E_NOERROR);
     318                 :         60 :           return 0;
     319                 :            :         }
     320                 :         92 :       int err = callback (&thread, arg);
     321         [ -  + ]:         90 :       if (err != DWARF_CB_OK)
     322                 :          0 :         return err;
     323         [ +  - ]:         90 :       assert (thread.unwound == NULL);
     324                 :            :     }
     325                 :            :   /* NOTREACHED */
     326                 :            : }
     327                 :            : INTDEF(dwfl_getthreads)
     328                 :            : 
     329                 :            : struct one_arg
     330                 :            : {
     331                 :            :   pid_t tid;
     332                 :            :   bool seen;
     333                 :            :   int (*callback) (Dwfl_Thread *thread, void *arg);
     334                 :            :   void *arg;
     335                 :            :   int ret;
     336                 :            : };
     337                 :            : 
     338                 :            : static int
     339                 :          0 : get_one_thread_cb (Dwfl_Thread *thread, void *arg)
     340                 :            : {
     341                 :          0 :   struct one_arg *oa = (struct one_arg *) arg;
     342   [ #  #  #  # ]:          0 :   if (! oa->seen && INTUSE(dwfl_thread_tid) (thread) == oa->tid)
     343                 :            :     {
     344                 :          0 :       oa->seen = true;
     345                 :          0 :       oa->ret = oa->callback (thread, oa->arg);
     346                 :          0 :       return DWARF_CB_ABORT;
     347                 :            :     }
     348                 :            : 
     349                 :            :   return DWARF_CB_OK;
     350                 :            : }
     351                 :            : 
     352                 :            : /* Note not currently exported, will be when there are more Dwfl_Thread
     353                 :            :    properties to query.  Use dwfl_getthread_frames for now directly.  */
     354                 :            : static int
     355                 :          0 : getthread (Dwfl *dwfl, pid_t tid,
     356                 :            :            int (*callback) (Dwfl_Thread *thread, void *arg),
     357                 :            :            void *arg)
     358                 :            : {
     359         [ #  # ]:          0 :   if (dwfl->attacherr != DWFL_E_NOERROR)
     360                 :            :     {
     361                 :          0 :       __libdwfl_seterrno (dwfl->attacherr);
     362                 :          0 :       return -1;
     363                 :            :     }
     364                 :            : 
     365                 :          0 :   Dwfl_Process *process = dwfl->process;
     366         [ #  # ]:          0 :   if (process == NULL)
     367                 :            :     {
     368                 :          0 :       __libdwfl_seterrno (DWFL_E_NO_ATTACH_STATE);
     369                 :          0 :       return -1;
     370                 :            :     }
     371                 :            : 
     372         [ #  # ]:          0 :   if (process->callbacks->get_thread != NULL)
     373                 :            :     {
     374                 :          0 :       Dwfl_Thread thread;
     375                 :          0 :       thread.process = process;
     376                 :          0 :       thread.unwound = NULL;
     377                 :          0 :       thread.callbacks_arg = NULL;
     378                 :          0 :       thread.aarch64.pauth_insn_mask = 0;
     379                 :            : 
     380         [ #  # ]:          0 :       if (process->callbacks->get_thread (dwfl, tid, process->callbacks_arg,
     381                 :            :                                           &thread.callbacks_arg))
     382                 :            :         {
     383                 :          0 :           thread.tid = tid;
     384                 :          0 :           return callback (&thread, arg);
     385                 :            :         }
     386                 :            : 
     387                 :            :       return -1;
     388                 :            :     }
     389                 :            : 
     390                 :          0 :    struct one_arg oa = { .tid = tid, .callback = callback,
     391                 :            :                          .arg = arg, .seen = false };
     392                 :          0 :    int err = INTUSE(dwfl_getthreads) (dwfl, get_one_thread_cb, &oa);
     393                 :            : 
     394   [ #  #  #  # ]:          0 :    if (err == DWARF_CB_ABORT && oa.seen)
     395                 :          0 :      return oa.ret;
     396                 :            : 
     397   [ #  #  #  # ]:          0 :    if (err == DWARF_CB_OK && ! oa.seen)
     398                 :            :      {
     399                 :          0 :         errno = ESRCH;
     400                 :          0 :         __libdwfl_seterrno (DWFL_E_ERRNO);
     401                 :          0 :         return -1;
     402                 :            :      }
     403                 :            : 
     404                 :            :    return err;
     405                 :            : }
     406                 :            : 
     407                 :            : struct one_thread
     408                 :            : {
     409                 :            :   int (*callback) (Dwfl_Frame *frame, void *arg);
     410                 :            :   void *arg;
     411                 :            : };
     412                 :            : 
     413                 :            : static int
     414                 :          0 : get_one_thread_frames_cb (Dwfl_Thread *thread, void *arg)
     415                 :            : {
     416                 :          0 :   struct one_thread *ot = (struct one_thread *) arg;
     417                 :          0 :   return INTUSE(dwfl_thread_getframes) (thread, ot->callback, ot->arg);
     418                 :            : }
     419                 :            : 
     420                 :            : int
     421                 :          0 : dwfl_getthread_frames (Dwfl *dwfl, pid_t tid,
     422                 :            :                        int (*callback) (Dwfl_Frame *frame, void *arg),
     423                 :            :                        void *arg)
     424                 :            : {
     425                 :          0 :   struct one_thread ot = { .callback = callback, .arg = arg };
     426                 :          0 :   return getthread (dwfl, tid, get_one_thread_frames_cb, &ot);
     427                 :            : }
     428                 :            : INTDEF(dwfl_getthread_frames)
     429                 :            : 
     430                 :            : int
     431                 :         86 : dwfl_thread_getframes (Dwfl_Thread *thread,
     432                 :            :                        int (*callback) (Dwfl_Frame *state, void *arg),
     433                 :            :                        void *arg)
     434                 :            : {
     435                 :         86 :   Ebl *ebl = thread->process->ebl;
     436         [ -  + ]:         86 :   if (ebl_frame_nregs (ebl) == 0)
     437                 :            :     {
     438                 :          0 :       __libdwfl_seterrno (DWFL_E_NO_UNWIND);
     439                 :          0 :       return -1;
     440                 :            :     }
     441         [ -  + ]:         86 :   if (state_alloc (thread) == NULL)
     442                 :            :     {
     443                 :          0 :       __libdwfl_seterrno (DWFL_E_NOMEM);
     444                 :          0 :       return -1;
     445                 :            :     }
     446                 :         86 :   Dwfl_Process *process = thread->process;
     447         [ -  + ]:         86 :   if (! process->callbacks->set_initial_registers (thread,
     448                 :            :                                                    thread->callbacks_arg))
     449                 :            :     {
     450                 :          0 :       free_states (thread->unwound);
     451                 :          0 :       thread->unwound = NULL;
     452                 :          0 :       return -1;
     453                 :            :     }
     454                 :         86 :   Dwfl_Frame *state = thread->unwound;
     455                 :         86 :   thread->unwound = NULL;
     456         [ -  + ]:         86 :   if (! state_fetch_pc (state))
     457                 :            :     {
     458         [ #  # ]:          0 :       if (process->callbacks->thread_detach)
     459                 :          0 :         process->callbacks->thread_detach (thread, thread->callbacks_arg);
     460                 :         36 :       free_states (state);
     461                 :            :       return -1;
     462                 :            :     }
     463                 :        428 :   do
     464                 :            :     {
     465                 :        428 :       int err = callback (state, arg);
     466         [ +  + ]:        426 :       if (err != DWARF_CB_OK)
     467                 :            :         {
     468         [ -  + ]:         14 :           if (process->callbacks->thread_detach)
     469                 :          0 :             process->callbacks->thread_detach (thread, thread->callbacks_arg);
     470                 :         84 :           free_states (state);
     471                 :            :           return err;
     472                 :            :         }
     473                 :        412 :       __libdwfl_frame_unwind (state);
     474                 :        412 :       Dwfl_Frame *next = state->unwound;
     475                 :            :       /* The old frame is no longer needed.  */
     476                 :        412 :       free (state);
     477                 :        412 :       state = next;
     478                 :            :     }
     479   [ +  +  +  + ]:        412 :   while (state && state->pc_state == DWFL_FRAME_STATE_PC_SET);
     480                 :            : 
     481                 :         70 :   Dwfl_Error err = dwfl_errno ();
     482         [ +  + ]:         70 :   if (process->callbacks->thread_detach)
     483                 :          6 :     process->callbacks->thread_detach (thread, thread->callbacks_arg);
     484   [ +  +  -  + ]:         70 :   if (state == NULL || state->pc_state == DWFL_FRAME_STATE_ERROR)
     485                 :            :     {
     486                 :         36 :       free_states (state);
     487                 :         36 :       __libdwfl_seterrno (err);
     488                 :         36 :       return -1;
     489                 :            :     }
     490         [ -  + ]:         34 :   assert (state->pc_state == DWFL_FRAME_STATE_PC_UNDEFINED);
     491                 :         84 :   free_states (state);
     492                 :            :   return 0;
     493                 :            : }
     494                 :            : INTDEF(dwfl_thread_getframes)

Generated by: LCOV version 1.16