]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix dwfl_attach_state machine->elf
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 14 Nov 2013 19:53:20 +0000 (20:53 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 14 Nov 2013 19:53:20 +0000 (20:53 +0100)
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_frame.c
libdwfl/libdwfl.h
libdwfl/linux-core-attach.c
libdwfl/linux-pid-attach.c

index 95e3cd7cc788873cd401f1354e60d8eb0186310b..561017b11b40b64b09821763129d1efcb376aba6 100644 (file)
@@ -1,3 +1,15 @@
+2013-11-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix dwfl_attach_state machine->elf.
+       * dwfl_frame.c (dwfl_attach_state): Change parameter machine to elf.
+       Call ebl_openbackend instead of ebl_openbackend_machine.
+       * libdwfl.h (dwfl_attach_state): Change parameter machine to elf.
+       Update the function description.
+       * linux-core-attach.c (__libdwfl_attach_state_for_core): Pass CORE to
+       dwfl_attach_state.
+       * linux-pid-attach.c (__libdwfl_attach_state_for_pid): Pass NULL to
+       dwfl_attach_state.
+
 2013-11-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Provide __libdwfl_module_getsym to get dwfl_file *.
index 11376c6eb275e2fd2f3881bda614e2ced1599ca4..f2863503d0a1256e43cc8ef87032d2e67f2ee29c 100644 (file)
@@ -131,7 +131,7 @@ process_alloc (Dwfl *dwfl)
 }
 
 bool
-dwfl_attach_state (Dwfl *dwfl, int machine, pid_t pid,
+dwfl_attach_state (Dwfl *dwfl, Elf *elf, pid_t pid,
                   const Dwfl_Thread_Callbacks *thread_callbacks, void *arg)
 {
   if (thread_callbacks == NULL || thread_callbacks->next_thread == NULL
@@ -147,9 +147,9 @@ dwfl_attach_state (Dwfl *dwfl, int machine, pid_t pid,
     }
   Ebl *ebl;
   bool ebl_close;
-  if (machine != EM_NONE)
+  if (elf != NULL)
     {
-      ebl = ebl_openbackend_machine (machine);
+      ebl = ebl_openbackend (elf);
       ebl_close = true;
     }
   else
index bbabb7088f1e3f5981ddbac5a48d57d1af030ee1..303f79cc9f124e7d2e6e922a1d177445fc5eb8f0 100644 (file)
@@ -625,13 +625,13 @@ typedef struct
 } Dwfl_Thread_Callbacks;
 
 /* PID is the process id associated with the DWFL state.  Architecture of DWFL
-   modules is specified by MACHINE.  Use EM_NONE to detect architecture from
-   DWFL.  If EBL is NULL the function will detect it from arbitrary Dwfl_Module
-   of DWFL.  DWFL_ARG is the callback backend state.  DWFL_ARG will be provided
-   to the callbacks.  *THREAD_CALLBACKS function pointers must remain valid
-   during lifetime of DWFL.  Function returns true on success,
-   false otherwise.  */
-bool dwfl_attach_state (Dwfl *dwfl, int machine, pid_t pid,
+   modules is specified by ELF, ELF must remain valid during DWFL lifetime.
+   Use NULL ELF to detect architecture from DWFL, the function will then detect
+   it from arbitrary Dwfl_Module of DWFL.  DWFL_ARG is the callback backend
+   state.  DWFL_ARG will be provided to the callbacks.  *THREAD_CALLBACKS
+   function pointers must remain valid during lifetime of DWFL.  Function
+   returns true on success, false otherwise.  */
+bool dwfl_attach_state (Dwfl *dwfl, Elf *elf, pid_t pid,
                         const Dwfl_Thread_Callbacks *thread_callbacks,
                        void *dwfl_arg)
   __nonnull_attribute__ (1, 4);
index 106d7649ad261f3e6db631bd119b1f8cff6c41f1..971d495f82c7a642dbdb55f772c1c84e1343c7d8 100644 (file)
@@ -369,8 +369,8 @@ __libdwfl_attach_state_for_core (Dwfl *dwfl, Elf *core)
   core_arg->note_data = note_data;
   core_arg->thread_note_offset = 0;
   core_arg->ebl = ebl;
-  if (! INTUSE(dwfl_attach_state) (dwfl, ebl_get_elfmachine (ebl), pid,
-                                  &core_thread_callbacks, core_arg))
+  if (! INTUSE(dwfl_attach_state) (dwfl, core, pid, &core_thread_callbacks,
+                                  core_arg))
     {
       free (core_arg);
       ebl_closebackend (ebl);
index 5ad58f6bf6db8291a32388bbd25f753740d22473..b4f31654b8ca3a0d0ad4639a85c50a122d4bca9c 100644 (file)
@@ -271,7 +271,7 @@ __libdwfl_attach_state_for_pid (Dwfl *dwfl, pid_t pid)
     }
   pid_arg->dir = dir;
   pid_arg->tid_attached = 0;
-  if (! INTUSE(dwfl_attach_state) (dwfl, EM_NONE, pid, &pid_thread_callbacks,
+  if (! INTUSE(dwfl_attach_state) (dwfl, NULL, pid, &pid_thread_callbacks,
                                   pid_arg))
     {
       closedir (dir);