2019-05-10 18:29:21 +03:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_nm.h :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: gtertysh <gtertysh@student.unit.ua> +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2019/05/06 22:37:16 by foton #+# #+# */
|
2019-08-10 17:56:26 +03:00
|
|
|
/* Updated: 2019/08/10 17:18:31 by gtertysh ### ########.fr */
|
2019-05-10 18:29:21 +03:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#ifndef FT_NM_H
|
2019-07-20 15:42:21 +03:00
|
|
|
#define FT_NM_H
|
2019-05-10 18:29:21 +03:00
|
|
|
|
2019-07-20 15:42:21 +03:00
|
|
|
#include <mach-o/loader.h>
|
|
|
|
#include <mach-o/nlist.h>
|
2019-07-27 20:03:42 +03:00
|
|
|
#include <mach-o/fat.h>
|
2019-07-27 20:46:16 +03:00
|
|
|
#include <ar.h>
|
2019-07-27 18:11:42 +03:00
|
|
|
#include <stddef.h>
|
2019-08-10 17:56:26 +03:00
|
|
|
#include "ft_file.h"
|
2019-07-13 19:35:42 +03:00
|
|
|
|
2019-07-27 18:11:42 +03:00
|
|
|
typedef struct symtab_command t_symtab_command;
|
2019-07-13 19:35:42 +03:00
|
|
|
typedef struct load_command t_load_command;
|
2019-07-27 18:11:42 +03:00
|
|
|
|
2019-07-13 19:35:42 +03:00
|
|
|
typedef struct mach_header_64 t_mach_header_64;
|
2019-07-27 18:11:42 +03:00
|
|
|
typedef struct mach_header t_mach_header_32;
|
2019-07-13 19:35:42 +03:00
|
|
|
typedef struct segment_command_64 t_segment_command_64;
|
2019-07-27 18:11:42 +03:00
|
|
|
typedef struct segment_command t_segment_command_32;
|
2019-07-13 19:35:42 +03:00
|
|
|
typedef struct nlist_64 t_nlist_64;
|
2019-07-27 18:11:42 +03:00
|
|
|
typedef struct nlist t_nlist_32;
|
2019-07-13 19:35:42 +03:00
|
|
|
typedef struct section_64 t_section_64;
|
2019-07-27 18:11:42 +03:00
|
|
|
typedef struct section t_section_32;
|
|
|
|
|
2019-07-20 15:42:21 +03:00
|
|
|
typedef struct s_nm_mach_64
|
|
|
|
{
|
|
|
|
t_mach_header_64 *header;
|
|
|
|
t_load_command *commands;
|
|
|
|
t_symtab_command *symbol_table_command;
|
2019-08-10 17:56:26 +03:00
|
|
|
t_segment_command_64 *text_command;
|
|
|
|
t_section_64 *text_section;
|
2019-07-20 15:42:21 +03:00
|
|
|
t_nlist_64 *symbol_table;
|
|
|
|
char *string_table;
|
|
|
|
} t_nm_mach_64;
|
|
|
|
|
2019-07-27 18:11:42 +03:00
|
|
|
typedef struct s_nm_mach_32
|
|
|
|
{
|
|
|
|
t_mach_header_32 *header;
|
|
|
|
t_load_command *commands;
|
|
|
|
t_symtab_command *symbol_table_command;
|
2019-08-10 17:56:26 +03:00
|
|
|
t_segment_command_32 *text_command;
|
|
|
|
t_section_32 *text_section;
|
2019-07-27 18:11:42 +03:00
|
|
|
t_nlist_32 *symbol_table;
|
|
|
|
char *string_table;
|
|
|
|
} t_nm_mach_32;
|
|
|
|
|
2019-07-27 20:03:42 +03:00
|
|
|
void fat
|
|
|
|
(
|
2019-08-10 17:56:26 +03:00
|
|
|
t_file *file
|
2019-07-27 20:03:42 +03:00
|
|
|
);
|
2019-07-20 15:42:21 +03:00
|
|
|
|
2019-07-27 20:46:16 +03:00
|
|
|
void ar
|
|
|
|
(
|
2019-08-10 17:56:26 +03:00
|
|
|
t_file *file
|
2019-07-27 20:46:16 +03:00
|
|
|
);
|
|
|
|
|
2019-07-20 15:42:21 +03:00
|
|
|
void macho64
|
|
|
|
(
|
2019-08-10 17:56:26 +03:00
|
|
|
t_file *file
|
2019-07-20 15:42:21 +03:00
|
|
|
);
|
|
|
|
|
2019-07-27 18:11:42 +03:00
|
|
|
void macho32
|
|
|
|
(
|
2019-08-10 17:56:26 +03:00
|
|
|
t_file *file
|
2019-07-27 18:11:42 +03:00
|
|
|
);
|
|
|
|
|
2019-07-20 15:42:21 +03:00
|
|
|
t_symtab_command *find_symbol_table_command
|
|
|
|
(
|
|
|
|
t_load_command *lc,
|
|
|
|
uint32_t count
|
|
|
|
);
|
|
|
|
|
|
|
|
void print_addr
|
|
|
|
(
|
2019-07-27 18:11:42 +03:00
|
|
|
size_t addr
|
2019-07-20 15:42:21 +03:00
|
|
|
);
|
|
|
|
|
2019-07-27 18:11:42 +03:00
|
|
|
void print_addr_32
|
|
|
|
(
|
|
|
|
size_t addr
|
|
|
|
);
|
|
|
|
|
2019-05-10 18:29:21 +03:00
|
|
|
#endif
|