2018-06-25 10:38:54 +00:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
2018-06-26 06:44:58 +00:00
|
|
|
#include <cstdio>
|
2018-06-25 10:38:54 +00:00
|
|
|
|
|
|
|
#include "creport_debug_types.hpp"
|
|
|
|
|
|
|
|
struct CodeInfo {
|
|
|
|
char name[0x20];
|
2018-06-25 15:50:36 +00:00
|
|
|
u8 build_id[0x20];
|
2018-06-25 10:38:54 +00:00
|
|
|
u64 start_address;
|
|
|
|
u64 end_address;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CodeList {
|
|
|
|
private:
|
|
|
|
static const size_t max_code_count = 0x10;
|
2018-07-02 14:26:03 +00:00
|
|
|
u32 code_count = 0;
|
2018-06-25 10:38:54 +00:00
|
|
|
CodeInfo code_infos[max_code_count];
|
2018-07-28 03:34:09 +00:00
|
|
|
|
|
|
|
/* For pretty-printing. */
|
|
|
|
char address_str_buf[0x280];
|
2018-07-02 14:26:03 +00:00
|
|
|
public:
|
2018-06-25 10:38:54 +00:00
|
|
|
void ReadCodeRegionsFromProcess(Handle debug_handle, u64 pc, u64 lr);
|
2018-07-28 03:34:09 +00:00
|
|
|
const char *GetFormattedAddressString(u64 address);
|
2018-06-26 06:44:58 +00:00
|
|
|
void SaveToFile(FILE *f_report);
|
2018-06-25 10:38:54 +00:00
|
|
|
private:
|
|
|
|
bool TryFindCodeRegion(Handle debug_handle, u64 guess, u64 *address);
|
2018-08-12 01:46:41 +00:00
|
|
|
void GetCodeInfoName(u64 debug_handle, u64 rx_address, u64 ro_address, char *name);
|
2018-06-25 15:50:36 +00:00
|
|
|
void GetCodeInfoBuildId(u64 debug_handle, u64 ro_address, u8 *build_id);
|
2018-06-25 10:38:54 +00:00
|
|
|
};
|