diff options
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/artificial.c | 4 | ||||
| -rw-r--r-- | src/arch/immediate.c | 27 | ||||
| -rw-r--r-- | src/arch/instruction-int.h | 2 | ||||
| -rw-r--r-- | src/arch/instruction.c | 2 | ||||
| -rw-r--r-- | src/arch/instruction.h | 4 | ||||
| -rw-r--r-- | src/arch/jvm/instruction.c | 4 | ||||
| -rw-r--r-- | src/arch/jvm/operand.c | 4 | ||||
| -rw-r--r-- | src/arch/mips/instruction.c | 4 | ||||
| -rw-r--r-- | src/arch/mips/operand.c | 12 | ||||
| -rw-r--r-- | src/arch/operand-int.h | 2 | ||||
| -rw-r--r-- | src/arch/operand.c | 2 | ||||
| -rw-r--r-- | src/arch/operand.h | 4 | ||||
| -rw-r--r-- | src/arch/processor.c | 4 | ||||
| -rw-r--r-- | src/arch/processor.h | 2 | ||||
| -rw-r--r-- | src/arch/x86/instruction.c | 4 | ||||
| -rw-r--r-- | src/arch/x86/operand.c | 16 | 
16 files changed, 50 insertions, 47 deletions
diff --git a/src/arch/artificial.c b/src/arch/artificial.c index 6783579..a1fa56e 100644 --- a/src/arch/artificial.c +++ b/src/arch/artificial.c @@ -54,7 +54,7 @@ static void g_db_instruction_class_init(GDbInstructionClass *);  static void g_db_instruction_init(GDbInstruction *);  /* Traduit une instruction en version humainement lisible. */ -static const char *g_db_instruction_get_text(const GDbInstruction *, const exe_format *, AsmSyntax); +static const char *g_db_instruction_get_text(const GDbInstruction *, const GExeFormat *, AsmSyntax);  /* Informe sur une éventuelle référence à une autre instruction. */  static InstructionLinkType g_db_instruction_get_link(const GDbInstruction *, vmpa_t *); @@ -166,7 +166,7 @@ GArchInstruction *g_db_instruction_new_from_data(const bin_t *data, off_t *pos,  *                                                                             *  ******************************************************************************/ -static const char *g_db_instruction_get_text(const GDbInstruction *instr, const exe_format *format, AsmSyntax syntax) +static const char *g_db_instruction_get_text(const GDbInstruction *instr, const GExeFormat *format, AsmSyntax syntax)  {      return "db"; diff --git a/src/arch/immediate.c b/src/arch/immediate.c index c57919f..f8bba35 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -31,6 +31,7 @@  #include "operand-int.h"  #include "../common/extstr.h" +#include "../format/format.h" @@ -83,7 +84,7 @@ static void g_imm_operand_class_init(GImmOperandClass *);  static void g_imm_operand_init(GImmOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_imm_operand_get_text(const GImmOperand *, const exe_format *, AsmSyntax); +static char *g_imm_operand_get_text(const GImmOperand *, const GExeFormat *, AsmSyntax);  /* Indique le type défini pour un opérande de valeur numérique. */ @@ -337,12 +338,13 @@ bool g_imm_operand_is_negative(const GImmOperand *operand)  *                                                                             *  ******************************************************************************/ -static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_imm_operand_get_text(const GImmOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */ -    char *label;                            /* Etiquette de symbole        */ -    SymbolType symtype;                     /* Type de symbole             */      vmpa_t address;                         /* Décallage final constaté    */ +    const char *label;                      /* Etiquette de symbole        */ +    SymbolType symtype;                     /* Type de symbole             */ +    char *printable;                        /* Version texte présentable   */      char buffer[256];                       /* Complément d'information    */      /* Valeur brute */ @@ -437,28 +439,29 @@ static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format      {          address = operand->unsigned_imm.val32; /* FIXME !!! */ -        if (resolve_exe_symbol(format, &label, &symtype, &address)) +        if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), &label, &symtype, &address))          {              switch (symtype)              { -                case STP_SECTION: +                case STP_OBJECT: +                case STP_FUNCTION:                      if (address == 0) snprintf(buffer, 256, " <%s>", label);                      else snprintf(buffer, 256, " <%s+0x%llx>", label, address);                      result = stradd(result, buffer);                      break;                  case STP_STRING: -                    label = escape_crlf(label); -                    label = strrpl(label, "<", "<"); -                    label = strrpl(label, ">", ">"); -                    snprintf(buffer, 256, " \"%s\"", label); +                    printable = strdup(label); +                    printable = escape_crlf(printable); +                    printable = strrpl(printable, "<", "<"); +                    printable = strrpl(printable, ">", ">"); +                    snprintf(buffer, 256, " \"%s\"", printable);                      result = stradd(result, buffer); +                    free(printable);                      break;              } -            free(label); -          }      } diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h index db6a3bf..ab37d62 100644 --- a/src/arch/instruction-int.h +++ b/src/arch/instruction-int.h @@ -31,7 +31,7 @@  /* Traduit une instruction en version humainement lisible. */ -typedef const char * (* get_instruction_text_fc) (const GArchInstruction *, const exe_format *, AsmSyntax); +typedef const char * (* get_instruction_text_fc) (const GArchInstruction *, const GExeFormat *, AsmSyntax);  /* Informe sur une éventuelle référence à une autre instruction. */  typedef InstructionLinkType (* get_instruction_link_fc) (const GArchInstruction *, vmpa_t *); diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 37b2147..338f496 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -317,7 +317,7 @@ void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *op  *                                                                             *  ******************************************************************************/ -char *g_arch_instruction_get_text(const GArchInstruction *instr, const exe_format *format, AsmSyntax syntax) +char *g_arch_instruction_get_text(const GArchInstruction *instr, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */      size_t i;                               /* Boucle de parcours          */ diff --git a/src/arch/instruction.h b/src/arch/instruction.h index 0e6444b..accaed6 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -32,7 +32,7 @@  #include "archbase.h"  #include "operand.h" -#include "../format/exe_format.h" +#include "../format/executable.h" @@ -92,7 +92,7 @@ void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, cons  void g_arch_instruction_detach_operand(GArchInstruction *, GArchOperand *);  /* Traduit une instruction en version humainement lisible. */ -char *g_arch_instruction_get_text(const GArchInstruction *, const exe_format *, AsmSyntax); +char *g_arch_instruction_get_text(const GArchInstruction *, const GExeFormat *, AsmSyntax);  /* Informe sur une éventuelle référence à une autre instruction. */  InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *, vmpa_t *); diff --git a/src/arch/jvm/instruction.c b/src/arch/jvm/instruction.c index 9ada8f0..1b927e5 100644 --- a/src/arch/jvm/instruction.c +++ b/src/arch/jvm/instruction.c @@ -151,7 +151,7 @@ static jvm_instruction _instructions[JOP_COUNT] = {  /* Traduit une instruction en version humainement lisible. */ -static const char *jvm_get_instruction_text(const GJvmInstruction *, const exe_format *, AsmSyntax); +static const char *jvm_get_instruction_text(const GJvmInstruction *, const GExeFormat *, AsmSyntax); @@ -293,7 +293,7 @@ JvmOpcodes jvm_guess_next_instruction(const bin_t *data, off_t pos, off_t len, b  *                                                                             *  ******************************************************************************/ -static const char *jvm_get_instruction_text(const GJvmInstruction *instr, const exe_format *format, AsmSyntax syntax) +static const char *jvm_get_instruction_text(const GJvmInstruction *instr, const GExeFormat *format, AsmSyntax syntax)  {      return _instructions[instr->type].keyword; diff --git a/src/arch/jvm/operand.c b/src/arch/jvm/operand.c index da95101..429516a 100644 --- a/src/arch/jvm/operand.c +++ b/src/arch/jvm/operand.c @@ -255,10 +255,10 @@ static char *g_jvm_ref_operand_get_text(const GJvmRefOperand *operand, const exe      switch (operand->type)      {          case JOT_FIELD_REF: -            result = build_reference_from_java_pool((const java_format *)format, operand->index, JRT_FIELD); +            result = NULL;//build_reference_from_java_pool((const java_format *)format, operand->index, JRT_FIELD);              break;          case JOT_METHOD_REF: -            result = build_reference_from_java_pool((const java_format *)format, operand->index, JRT_METHOD); +            result = NULL;//build_reference_from_java_pool((const java_format *)format, operand->index, JRT_METHOD);              break;          default:              result = NULL; diff --git a/src/arch/mips/instruction.c b/src/arch/mips/instruction.c index 54999a1..fd39d5c 100644 --- a/src/arch/mips/instruction.c +++ b/src/arch/mips/instruction.c @@ -126,7 +126,7 @@ static mips_instruction _instructions[MOP_COUNT] = {  /* Traduit une instruction en version humainement lisible. */ -static const char *mips_get_instruction_text(const GMipsInstruction *, const exe_format *, AsmSyntax); +static const char *mips_get_instruction_text(const GMipsInstruction *, const GExeFormat *, AsmSyntax); @@ -274,7 +274,7 @@ MipsOpcodes mips_guess_next_instruction(const bin_t *data, off_t pos, off_t len)  *                                                                             *  ******************************************************************************/ -static const char *mips_get_instruction_text(const GMipsInstruction *instr, const exe_format *format, AsmSyntax syntax) +static const char *mips_get_instruction_text(const GMipsInstruction *instr, const GExeFormat *format, AsmSyntax syntax)  {      const char *result;                     /* Chaîne à retourner          */ diff --git a/src/arch/mips/operand.c b/src/arch/mips/operand.c index 68599a4..4021cf6 100644 --- a/src/arch/mips/operand.c +++ b/src/arch/mips/operand.c @@ -89,7 +89,7 @@ static void g_mips_register_operand_class_init(GMipsRegisterOperandClass *);  static void g_mips_register_operand_init(GMipsRegisterOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_mips_register_operand_get_text(const GMipsRegisterOperand *, const exe_format *, AsmSyntax); +static char *g_mips_register_operand_get_text(const GMipsRegisterOperand *, const GExeFormat *, AsmSyntax); @@ -122,7 +122,7 @@ static void g_mips_mem_content_operand_class_init(GMipsMemContentOperandClass *)  static void g_mips_mem_content_operand_init(GMipsMemContentOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_mips_mem_content_operand_get_text(const GMipsMemContentOperand *, const exe_format *, AsmSyntax); +static char *g_mips_mem_content_operand_get_text(const GMipsMemContentOperand *, const GExeFormat *, AsmSyntax); @@ -154,7 +154,7 @@ static void g_mips_offset_operand_class_init(GMipsOffsetOperandClass *);  static void g_mips_offset_operand_init(GMipsOffsetOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_mips_offset_operand_get_text(const GMipsOffsetOperand *, const exe_format *, AsmSyntax); +static char *g_mips_offset_operand_get_text(const GMipsOffsetOperand *, const GExeFormat *, AsmSyntax); @@ -301,7 +301,7 @@ GArchOperand *g_mips_register_operand_new(bin_t index)  *                                                                             *  ******************************************************************************/ -static char *g_mips_register_operand_get_text(const GMipsRegisterOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_mips_register_operand_get_text(const GMipsRegisterOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */ @@ -431,7 +431,7 @@ GArchOperand *g_mips_mem_content_operand_new(bin_t index, int16_t offset)  *                                                                             *  ******************************************************************************/ -static char *g_mips_mem_content_operand_get_text(const GMipsMemContentOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_mips_mem_content_operand_get_text(const GMipsMemContentOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */      char *tmp;                              /* Déplacement                 */ @@ -544,7 +544,7 @@ GArchOperand *g_mips_offset_operand_new(int16_t offset)  *                                                                             *  ******************************************************************************/ -static char *g_mips_offset_operand_get_text(const GMipsOffsetOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_mips_offset_operand_get_text(const GMipsOffsetOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      return g_arch_operand_get_text(G_ARCH_OPERAND(operand->offset), format, syntax); diff --git a/src/arch/operand-int.h b/src/arch/operand-int.h index 8048548..90e3e06 100644 --- a/src/arch/operand-int.h +++ b/src/arch/operand-int.h @@ -30,7 +30,7 @@  /* Traduit un opérande en version humainement lisible. */ -typedef char * (* get_operand_text_fc) (const GArchOperand *, const exe_format *, AsmSyntax); +typedef char * (* get_operand_text_fc) (const GArchOperand *, const GExeFormat *, AsmSyntax);  /* Définition générique d'un opérande d'architecture (instance) */ diff --git a/src/arch/operand.c b/src/arch/operand.c index 0f488b3..724f3c0 100644 --- a/src/arch/operand.c +++ b/src/arch/operand.c @@ -91,7 +91,7 @@ static void g_arch_operand_init(GArchOperand *operand)  *                                                                             *  ******************************************************************************/ -char *g_arch_operand_get_text(const GArchOperand *operand, const exe_format *format, AsmSyntax syntax) +char *g_arch_operand_get_text(const GArchOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      return operand->get_text(operand, format, syntax); diff --git a/src/arch/operand.h b/src/arch/operand.h index cd7b213..c84c7fb 100644 --- a/src/arch/operand.h +++ b/src/arch/operand.h @@ -62,7 +62,7 @@ typedef enum _AsmOperandSize  #include <glib-object.h> -#include "../format/exe_format.h" +#include "../format/executable.h" @@ -83,7 +83,7 @@ typedef struct _GArchOperandClass GArchOperandClass;  GType g_arch_operand_get_type(void);  /* Traduit un opérande en version humainement lisible. */ -char *g_arch_operand_get_text(const GArchOperand *, const exe_format *, AsmSyntax); +char *g_arch_operand_get_text(const GArchOperand *, const GExeFormat *, AsmSyntax); diff --git a/src/arch/processor.c b/src/arch/processor.c index c8630d7..103296a 100644 --- a/src/arch/processor.c +++ b/src/arch/processor.c @@ -249,11 +249,11 @@ GArchProcessor *get_arch_processor_for_type(ArchProcessorType type)  *                                                                             *  ******************************************************************************/ -GArchProcessor *get_arch_processor_from_format(const exe_format *format) +GArchProcessor *get_arch_processor_from_format(const GExeFormat *format)  {      GArchProcessor *result;                 /* Conversion à retourner      */ -    switch (get_exe_target_machine(format)) +    switch (g_exe_format_get_target_machine(format))      {          case FTM_JVM:              result = get_arch_processor_for_type(APT_JVM); diff --git a/src/arch/processor.h b/src/arch/processor.h index 8529d50..ea954cc 100644 --- a/src/arch/processor.h +++ b/src/arch/processor.h @@ -82,7 +82,7 @@ bool init_all_processors(void);  GArchProcessor *get_arch_processor_for_type(ArchProcessorType);  /* Fournit le processeur d'architecture lié à un format. */ -GArchProcessor *get_arch_processor_from_format(const exe_format *); +GArchProcessor *get_arch_processor_from_format(const GExeFormat *); diff --git a/src/arch/x86/instruction.c b/src/arch/x86/instruction.c index 0af29c1..65be263 100644 --- a/src/arch/x86/instruction.c +++ b/src/arch/x86/instruction.c @@ -321,7 +321,7 @@ static x86_instruction _instructions[XOP_COUNT] = {  /* Traduit une instruction en version humainement lisible. */ -static const char *x86_get_instruction_text(const GX86Instruction *, const exe_format *, AsmSyntax); +static const char *x86_get_instruction_text(const GX86Instruction *, const GExeFormat *, AsmSyntax);  /* Informe sur une éventuelle référence à une autre instruction. */  static InstructionLinkType x86_get_instruction_link(const GX86Instruction *, vmpa_t *); @@ -537,7 +537,7 @@ X86Opcodes x86_guess_next_instruction(const bin_t *data, off_t pos, off_t len, X  *                                                                             *  ******************************************************************************/ -static const char *x86_get_instruction_text(const GX86Instruction *instr, const exe_format *format, AsmSyntax syntax) +static const char *x86_get_instruction_text(const GX86Instruction *instr, const GExeFormat *format, AsmSyntax syntax)  {      const char *result;                     /* Chaîne à retourner          */ diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c index 24613cf..69c08dc 100644 --- a/src/arch/x86/operand.c +++ b/src/arch/x86/operand.c @@ -90,7 +90,7 @@ static void g_x86_register_operand_class_init(GX86RegisterOperandClass *);  static void g_x86_register_operand_init(GX86RegisterOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_x86_register_operand_get_text(const GX86RegisterOperand *, const exe_format *, AsmSyntax); +static char *g_x86_register_operand_get_text(const GX86RegisterOperand *, const GExeFormat *, AsmSyntax); @@ -125,7 +125,7 @@ static void g_x86_mod_rm_operand_class_init(GX86ModRMOperandClass *);  static void g_x86_mod_rm_operand_init(GX86ModRMOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_x86_mod_rm_operand_get_text(const GX86ModRMOperand *, const exe_format *, AsmSyntax); +static char *g_x86_mod_rm_operand_get_text(const GX86ModRMOperand *, const GExeFormat *, AsmSyntax); @@ -156,7 +156,7 @@ static void g_x86_relative_operand_class_init(GX86RelativeOperandClass *);  static void g_x86_relative_operand_init(GX86RelativeOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_x86_relative_operand_get_text(const GX86RelativeOperand *, const exe_format *, AsmSyntax); +static char *g_x86_relative_operand_get_text(const GX86RelativeOperand *, const GExeFormat *, AsmSyntax); @@ -187,7 +187,7 @@ static void g_x86_moffs_operand_class_init(GX86MOffsOperandClass *);  static void g_x86_moffs_operand_init(GX86MOffsOperand *);  /* Traduit un opérande en version humainement lisible. */ -static char *g_x86_moffs_operand_get_text(const GX86MOffsOperand *, const exe_format *, AsmSyntax); +static char *g_x86_moffs_operand_get_text(const GX86MOffsOperand *, const GExeFormat *, AsmSyntax); @@ -417,7 +417,7 @@ GArchOperand *g_x86_register_operand_new_from_index(bin_t index, AsmOperandSize  *                                                                             *  ******************************************************************************/ -static char *g_x86_register_operand_get_text(const GX86RegisterOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_x86_register_operand_get_text(const GX86RegisterOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */ @@ -596,7 +596,7 @@ GArchOperand *g_x86_mod_rm_operand_new(const bin_t *data, off_t *pos, off_t len,  *                                                                             *  ******************************************************************************/ -static char *g_x86_mod_rm_operand_get_text(const GX86ModRMOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_x86_mod_rm_operand_get_text(const GX86ModRMOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */      char *tmp;                              /* Chaîne de registre          */ @@ -834,7 +834,7 @@ GArchOperand *g_x86_relative_operand_new(const bin_t *data, off_t *pos, off_t le  *                                                                             *  ******************************************************************************/ -static char *g_x86_relative_operand_get_text(const GX86RelativeOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_x86_relative_operand_get_text(const GX86RelativeOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */ @@ -964,7 +964,7 @@ GArchOperand *g_x86_moffs_operand_new(const bin_t *data, off_t *pos, off_t len,  *                                                                             *  ******************************************************************************/ -static char *g_x86_moffs_operand_get_text(const GX86MOffsOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_x86_moffs_operand_get_text(const GX86MOffsOperand *operand, const GExeFormat *format, AsmSyntax syntax)  {      char *result;                           /* Chaîne à retourner          */  | 
