Created
May 23, 2017 03:25
-
-
Save techvoltage/b48c56d5a27334e299e9623eb648e4a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _GNU_SOURCE | |
| #include <link.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| static int | |
| callback(struct dl_phdr_info *info, size_t size, void *data) | |
| { | |
| int j; | |
| printf("name=%s (%d segments)\n", info->dlpi_name, | |
| info->dlpi_phnum); | |
| for (j = 0; j < info->dlpi_phnum; j++) | |
| printf("\t\t header %2d: address=%10p\n", j, | |
| (void *) (info->dlpi_addr + info->dlpi_phdr[j].p_vaddr)); | |
| return 0; | |
| } | |
| int | |
| main(int argc, char *argv[]) | |
| { | |
| dl_iterate_phdr(callback, NULL); | |
| exit(EXIT_SUCCESS); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment