This field indicates whether the executable or library is position
independent code (PIC). The field is not added to the similar dlopen
event from liblttng-ust-dl because in that case all dlopened libraries
are necessarily PIC.
This allows a posteriori analyses to be performed without having to
read the executable file to know whether adresses are relative to the
base address or absolute.
Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This event has no fields.
`lttng_ust_statedump:soinfo`::
This event has no fields.
`lttng_ust_statedump:soinfo`::
- Emitted when information about a currently loaded shared object is
- found.
+ Emitted when information about a currently loaded executable or
+ shared object is found.
+
Fields:
+
[options="header"]
+
Fields:
+
[options="header"]
-|==============================================================
+|==================================================================
| Field name | Description
| Field name | Description
-| `baddr` | Base address of loaded library
-| `memsz` | Size of loaded library in memory
-| `sopath` | Path to loaded library file
-|==============================================================
+| `baddr` | Base address of loaded executable
+| `memsz` | Size of loaded executable in memory
+| `sopath` | Path to loaded executable file
+| `is_pic` | Whether the executable is
+ position-independent code
+|==================================================================
`lttng_ust_statedump:build_id`::
Emitted when a build ID is found in a currently loaded shared
`lttng_ust_statedump:build_id`::
Emitted when a build ID is found in a currently loaded shared
struct lttng_ust_elf *lttng_ust_elf_create(const char *path);
void lttng_ust_elf_destroy(struct lttng_ust_elf *elf);
struct lttng_ust_elf *lttng_ust_elf_create(const char *path);
void lttng_ust_elf_destroy(struct lttng_ust_elf *elf);
+uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf);
int lttng_ust_elf_get_memsz(struct lttng_ust_elf *elf, uint64_t *memsz);
int lttng_ust_elf_get_build_id(struct lttng_ust_elf *elf, uint8_t **build_id,
size_t *length, int *found);
int lttng_ust_elf_get_memsz(struct lttng_ust_elf *elf, uint64_t *memsz);
int lttng_ust_elf_get_build_id(struct lttng_ust_elf *elf, uint8_t **build_id,
size_t *length, int *found);
+/*
+ * Test whether the ELF file is position independent code (PIC)
+ */
+uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf)
+{
+ /*
+ * PIC has and e_type value of ET_DYN, see ELF specification
+ * version 1.1 p. 1-3.
+ */
+ return elf->ehdr->e_type == ET_DYN;
+}
+
/*
* Destroy the given lttng_ust_elf instance.
*/
/*
* Destroy the given lttng_ust_elf instance.
*/
struct lttng_session *, session,
void *, baddr,
const char*, sopath,
struct lttng_session *, session,
void *, baddr,
const char*, sopath,
+ uint64_t, memsz,
+ uint8_t, is_pic
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_string(sopath, sopath)
),
TP_FIELDS(
ctf_integer_hex(void *, baddr, baddr)
ctf_integer(uint64_t, memsz, memsz)
ctf_string(sopath, sopath)
+ ctf_integer(uint8_t, is_pic, is_pic)
size_t build_id_len;
int vdso;
uint32_t crc;
size_t build_id_len;
int vdso;
uint32_t crc;
};
typedef void (*tracepoint_cb)(struct lttng_session *session, void *priv);
};
typedef void (*tracepoint_cb)(struct lttng_session *session, void *priv);
tracepoint(lttng_ust_statedump, soinfo,
session, so_data->base_addr_ptr,
tracepoint(lttng_ust_statedump, soinfo,
session, so_data->base_addr_ptr,
- so_data->resolved_path, so_data->memsz);
+ so_data->resolved_path, so_data->memsz, so_data->is_pic);
+ so_data->is_pic = lttng_ust_elf_is_pic(elf);
+
end:
lttng_ust_elf_destroy(elf);
return ret;
end:
lttng_ust_elf_destroy(elf);
return ret;