miasm
Reverse engineering framework
expr_c Namespace Reference

Variables

string text
 
 base_types = CTypeAMD64_unk()
 
 types_ast = CAstTypes()
 
 types_mngr = CTypesManagerNotPacked(types_ast, base_types)
 
 ptr_rectangle = types_mngr.get_objc(CTypePtr(CTypeStruct('rectangle')))
 
 ptr = ExprId('ptr', 64)
 
dictionary c_context = {ptr.name: ptr_rectangle}
 
 mychandler = CHandler(types_mngr, C_types=c_context)
 
list c_acceses
 
 expr = mychandler.c_to_expr(c_str)
 
 c_type = mychandler.c_to_type(c_str)
 

Detailed Description

Parse C expression to access variables and retrieve information:
* Miasm expression to access this variable
* variable type

Variable Documentation

◆ base_types

expr_c.base_types = CTypeAMD64_unk()

◆ c_acceses

list expr_c.c_acceses
Initial value:
1 = ["ptr->width",
2  "ptr->length",
3  "ptr->line",
4  "ptr->line->color",
5  "ptr->line->color[3]",
6  "ptr->line->size"
7  ]

◆ c_context

dictionary expr_c.c_context = {ptr.name: ptr_rectangle}

◆ c_type

expr_c.c_type = mychandler.c_to_type(c_str)

◆ expr

expr_c.expr = mychandler.c_to_expr(c_str)

◆ mychandler

expr_c.mychandler = CHandler(types_mngr, C_types=c_context)

◆ ptr

expr_c.ptr = ExprId('ptr', 64)

◆ ptr_rectangle

expr_c.ptr_rectangle = types_mngr.get_objc(CTypePtr(CTypeStruct('rectangle')))

◆ text

string expr_c.text
Initial value:
1 = """
2 struct line {
3  char color[20];
4  int size;
5 };
6 
7 struct rectangle {
8  unsigned int width;
9  unsigned int length;
10  struct line* line;
11 };
12 """

◆ types_ast

expr_c.types_ast = CAstTypes()

◆ types_mngr