Files
Paweł Marczewski 5ef9bdc861 [Pal] Unify debug maps
- Use the same mechanism (debug_map) in Pal/Linux and Pal/Linux-SGX.
  Previously, Pal/Linux emulated the _r_debug structure, normally
  maintained by ld.so, but that cannot be done in SGX outer PAL,
  because it's loaded by ld.so already.
- Maintain the debug maps outside of SGX enclave. This allows
  initializing them before enclave start, and potentially makes
  them easier to use.
- Initialize PAL debug map before enclave start. Previously, this
  was done from inside the enclave, so you couldn't set a
  breakpoint too early (e.g. in pal_linux_main).
- Store only load address, without list of sections. This is to
  avoid parsing the list of sections just to report them to the
  debugger. Unfortunately, the GDB version that we support still
  needs these sections, but we can retrieve them in GDB plugin.
- Move Python GDB code related to debug maps to a common file.
2021-01-18 03:49:18 +01:00

32 lines
804 B
C

/* SPDX-License-Identifier: LGPL-3.0-or-later */
/* Copyright (C) 2020 Intel Corporation
* Paweł Marczewski <pawel@invisiblethingslab.com>
*/
/*
* Internal debug maps, used to communicate with GDB.
*
* Note that this is part of a common library, and not part of libpal, to support setups in which
* the debug maps are maintained in an "outer" binary instead of the main PAL binary.
*/
#ifndef PAL_DEBUG_MAP_H
#define PAL_DEBUG_MAP_H
struct debug_map {
char* name;
void* addr;
struct debug_map* _Atomic next;
};
extern struct debug_map* _Atomic g_debug_map;
/* GDB will set a breakpoint on this function. */
void debug_map_update_debugger(void);
int debug_map_add(const char* name, void* addr);
int debug_map_remove(void* addr);
#endif /* PAL_DEBUG_MAP_H */