mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-22 19:43:42 +01:00
Init eh_elf structures upon unw_init_*
This commit is contained in:
parent
da7446a21a
commit
4fb0baaa89
4 changed files with 64 additions and 0 deletions
16
src/eh_elf/eh_elf.c
Normal file
16
src/eh_elf/eh_elf.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/********** Libunwind -- eh_elf flavour **********
|
||||
* This is the eh_elf version of libunwind, made for academic purposes.
|
||||
*
|
||||
* Théophile Bastian <theophile.bastian@ens.fr> <contact+github@tobast.fr>
|
||||
*************************************************
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
************************************************/
|
||||
|
||||
#include "eh_elf_i.h"
|
||||
|
42
src/eh_elf/eh_elf.h
Normal file
42
src/eh_elf/eh_elf.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/********** Libunwind -- eh_elf flavour **********
|
||||
* This is the eh_elf version of libunwind, made for academic purposes.
|
||||
*
|
||||
* Théophile Bastian <theophile.bastian@ens.fr> <contact+github@tobast.fr>
|
||||
*************************************************
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "libunwind_i.h"
|
||||
|
||||
/// Store the necessary data for a single eh_elf
|
||||
typedef struct {
|
||||
// TODO
|
||||
} eh_elf_handle_t;
|
||||
|
||||
/** Initialize everything for local memory analysis
|
||||
* @return 0 on success, or a negative value upon failure
|
||||
**/
|
||||
int eh_elf_init_local();
|
||||
|
||||
/** Initialize everything for the remote analysis of the process of given PID
|
||||
* @return 0 on success, or a negative value upon failure
|
||||
**/
|
||||
int eh_elf_init_pid(pid_t pid);
|
||||
|
||||
/// Cleanup everything that was allocated by eh_elf_init_*
|
||||
void eh_elf_clean();
|
||||
|
||||
/** Step the cursor using eh_elf mechanisms.
|
||||
*
|
||||
* Return 0 if everything went file, otherwise, return a negative value.
|
||||
**/
|
||||
int eh_elf_step_cursor(struct cursor *cursor);
|
|
@ -26,6 +26,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "unwind_i.h"
|
||||
#include "../eh_elf/eh_elf.h"
|
||||
#include "init.h"
|
||||
|
||||
#ifdef UNW_REMOTE_ONLY
|
||||
|
@ -41,6 +42,8 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
|
|||
PROTECTED int
|
||||
unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
|
||||
{
|
||||
eh_elf_init_local();
|
||||
|
||||
struct cursor *c = (struct cursor *) cursor;
|
||||
|
||||
if (unlikely (!tdep_init_done))
|
||||
|
|
|
@ -26,6 +26,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "init.h"
|
||||
#include "../eh_elf/eh_elf.h"
|
||||
#include "unwind_i.h"
|
||||
|
||||
PROTECTED int
|
||||
|
@ -41,6 +42,8 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
|
|||
|
||||
Debug (1, "(cursor=%p)\n", c);
|
||||
|
||||
eh_elf_init_pid(as.acc.get_pid(as_arg));
|
||||
|
||||
c->dwarf.as = as;
|
||||
if (as == unw_local_addr_space)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue