Rizin
unix-like reverse engineering framework and cli tools
rz_il_events.h File Reference

list of types of events that can happen on the VM More...

Go to the source code of this file.

Classes

struct  rz_il_vm_event_mem_read_t
 
struct  rz_il_vm_event_var_read_t
 
struct  rz_il_vm_event_pc_write_t
 
struct  rz_il_vm_event_mem_write_t
 
struct  rz_il_vm_event_var_write_t
 
struct  rz_il_vm_event_t
 

Typedefs

typedef enum rz_il_event_id_t RzILEventId
 
typedef struct rz_il_vm_event_mem_read_t RzILEventMemRead
 
typedef struct rz_il_vm_event_var_read_t RzILEventVarRead
 
typedef struct rz_il_vm_event_pc_write_t RzILEventPCWrite
 
typedef struct rz_il_vm_event_mem_write_t RzILEventMemWrite
 
typedef struct rz_il_vm_event_var_write_t RzILEventVarWrite
 
typedef struct rz_il_vm_event_t RzILEvent
 

Enumerations

enum  rz_il_event_id_t {
  RZ_IL_EVENT_EXCEPTION = 0 , RZ_IL_EVENT_PC_WRITE , RZ_IL_EVENT_MEM_READ , RZ_IL_EVENT_VAR_READ ,
  RZ_IL_EVENT_MEM_WRITE , RZ_IL_EVENT_VAR_WRITE
}
 

Functions

RZ_API RZ_OWN RzILEventrz_il_event_exception_new (RZ_NONNULL const char *exception)
 
RZ_API RZ_OWN RzILEventrz_il_event_pc_write_new (RZ_NONNULL const RzBitVector *old_pc, RZ_NONNULL const RzBitVector *new_pc)
 
RZ_API RZ_OWN RzILEventrz_il_event_mem_read_new (RZ_NONNULL const RzBitVector *addr, RZ_NULLABLE const RzBitVector *value)
 
RZ_API RZ_OWN RzILEventrz_il_event_var_read_new (RZ_NONNULL const char *name, RZ_NULLABLE const RzILVal *value)
 
RZ_API RZ_OWN RzILEventrz_il_event_mem_write_new (RZ_NONNULL const RzBitVector *addr, RZ_NONNULL const RzBitVector *old_v, RZ_NONNULL const RzBitVector *new_v)
 
RZ_API RZ_OWN RzILEventrz_il_event_var_write_new (RZ_NONNULL const char *name, RZ_NULLABLE const RzILVal *old_v, RZ_NONNULL const RzILVal *new_v)
 
RZ_API void rz_il_event_free (RZ_NULLABLE RzILEvent *evt)
 
RZ_API void rz_il_event_stringify (RZ_NONNULL const RzILEvent *evt, RZ_NONNULL RzStrBuf *sb)
 
RZ_API void rz_il_event_json (RZ_NONNULL RzILEvent *evt, RZ_NONNULL PJ *pj)
 

Detailed Description

list of types of events that can happen on the VM

Definition in file rz_il_events.h.

Typedef Documentation

◆ RzILEvent

typedef struct rz_il_vm_event_t RzILEvent

◆ RzILEventId

◆ RzILEventMemRead

◆ RzILEventMemWrite

◆ RzILEventPCWrite

◆ RzILEventVarRead

◆ RzILEventVarWrite

Enumeration Type Documentation

◆ rz_il_event_id_t

Enumerator
RZ_IL_EVENT_EXCEPTION 
RZ_IL_EVENT_PC_WRITE 
RZ_IL_EVENT_MEM_READ 
RZ_IL_EVENT_VAR_READ 
RZ_IL_EVENT_MEM_WRITE 
RZ_IL_EVENT_VAR_WRITE 

Definition at line 19 of file rz_il_events.h.

19  {
26 } RzILEventId;
@ RZ_IL_EVENT_VAR_READ
Definition: rz_il_events.h:23
@ RZ_IL_EVENT_MEM_READ
Definition: rz_il_events.h:22
@ RZ_IL_EVENT_MEM_WRITE
Definition: rz_il_events.h:24
@ RZ_IL_EVENT_EXCEPTION
Definition: rz_il_events.h:20
@ RZ_IL_EVENT_VAR_WRITE
Definition: rz_il_events.h:25
@ RZ_IL_EVENT_PC_WRITE
Definition: rz_il_events.h:21
enum rz_il_event_id_t RzILEventId

Function Documentation

◆ rz_il_event_exception_new()

RZ_API RZ_OWN RzILEvent* rz_il_event_exception_new ( RZ_NONNULL const char *  exception)

Creates an RzILEvent of type RZ_IL_EVENT_EXCEPTION

Parameters
exception,constchar, pointer to the exception message

Definition at line 52 of file il_events.c.

52  {
54 
55  RzILEvent *evt = RZ_NEW(RzILEvent);
56  if (!evt) {
57  RZ_LOG_ERROR("RzIL: cannot allocate exception RzILEvent");
58  return NULL;
59  }
60 
63  if (!evt->data.exception) {
64  rz_il_event_free(evt);
65  RZ_LOG_ERROR("RzIL: cannot allocate exception string");
66  return NULL;
67  }
68  return evt;
69 }
@ exception
Definition: aarch64.h:495
#define NULL
Definition: cris-opc.c:27
RZ_API void rz_il_event_free(RZ_NULLABLE RzILEvent *evt)
Definition: il_events.c:11
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
#define RZ_NEW(x)
Definition: rz_types.h:285
RzILEventId type
Definition: rz_il_events.h:56
union rz_il_vm_event_t::@285 data

References rz_il_vm_event_t::data, exception, rz_il_vm_event_t::exception, NULL, RZ_IL_EVENT_EXCEPTION, rz_il_event_free(), RZ_LOG_ERROR, RZ_NEW, rz_return_val_if_fail, strdup(), and rz_il_vm_event_t::type.

Referenced by rz_il_handler_div().

◆ rz_il_event_free()

RZ_API void rz_il_event_free ( RZ_NULLABLE RzILEvent evt)

Frees an RzILEvent struct

Parameters
evt,RzILEvent,pointerto the RzILEvent to free

Definition at line 11 of file il_events.c.

11  {
12  if (!evt) {
13  return;
14  }
15  switch (evt->type) {
17  free(evt->data.exception);
18  break;
20  rz_bv_free(evt->data.pc_write.old_pc);
21  rz_bv_free(evt->data.pc_write.new_pc);
22  break;
24  rz_bv_free(evt->data.mem_read.address);
25  rz_bv_free(evt->data.mem_read.value);
26  break;
28  free(evt->data.var_read.variable);
29  rz_il_value_free(evt->data.var_read.value);
30  break;
32  rz_bv_free(evt->data.mem_write.address);
33  rz_bv_free(evt->data.mem_write.old_value);
34  rz_bv_free(evt->data.mem_write.new_value);
35  break;
37  free(evt->data.var_write.variable);
38  rz_il_value_free(evt->data.var_write.old_value);
39  rz_il_value_free(evt->data.var_write.new_value);
40  break;
41  default:
43  break;
44  }
45  free(evt);
46 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API void rz_il_value_free(RZ_NULLABLE RzILVal *val)
Definition: value.c:107
#define rz_warn_if_reached()
Definition: rz_assert.h:29
RZ_API void rz_bv_free(RZ_NULLABLE RzBitVector *bv)
Definition: bitvector.c:85

References free(), rz_bv_free(), RZ_IL_EVENT_EXCEPTION, RZ_IL_EVENT_MEM_READ, RZ_IL_EVENT_MEM_WRITE, RZ_IL_EVENT_PC_WRITE, RZ_IL_EVENT_VAR_READ, RZ_IL_EVENT_VAR_WRITE, rz_il_value_free(), and rz_warn_if_reached.

Referenced by rz_il_event_exception_new(), rz_il_event_mem_read_new(), rz_il_event_mem_write_new(), rz_il_event_pc_write_new(), rz_il_event_var_read_new(), rz_il_event_var_write_new(), rz_il_vm_event_add(), and rz_il_vm_init().

◆ rz_il_event_json()

RZ_API void rz_il_event_json ( RZ_NONNULL RzILEvent evt,
RZ_NONNULL PJ pj 
)

Definition at line 797 of file il_export.c.

797  {
798  rz_return_if_fail(evt && pj);
799  char *tmp0 = NULL, *tmp1 = NULL, *tmp2 = NULL;
800 
801  switch (evt->type) {
803  pj_o(pj);
804  pj_ks(pj, "type", "exception");
805  pj_ks(pj, "exception", evt->data.exception);
806  pj_end(pj);
807  break;
809  tmp0 = rz_bv_as_hex_string(evt->data.pc_write.old_pc, false);
810  tmp1 = rz_bv_as_hex_string(evt->data.pc_write.new_pc, false);
811  pj_o(pj);
812  pj_ks(pj, "type", "pc_write");
813  pj_ks(pj, "old", tmp0);
814  pj_ks(pj, "new", tmp1);
815  pj_end(pj);
816  break;
818  tmp0 = rz_bv_as_hex_string(evt->data.mem_read.address, false);
819  tmp1 = rz_bv_as_hex_string(evt->data.mem_read.value, false);
820  pj_o(pj);
821  pj_ks(pj, "type", "mem_read");
822  pj_ks(pj, "address", tmp0);
823  pj_ks(pj, "value", tmp1);
824  pj_end(pj);
825  break;
827  tmp1 = rz_il_value_stringify(evt->data.var_read.value);
828  pj_o(pj);
829  pj_ks(pj, "type", "var_read");
830  pj_ks(pj, "name", evt->data.var_read.variable);
831  pj_ks(pj, "value", tmp1 ? tmp1 : "uninitialized variable");
832  pj_end(pj);
833  break;
835  tmp0 = rz_bv_as_hex_string(evt->data.mem_write.address, false);
836  tmp1 = evt->data.mem_write.old_value ? rz_bv_as_hex_string(evt->data.mem_write.old_value, false) : NULL;
837  tmp2 = rz_bv_as_hex_string(evt->data.mem_write.new_value, false);
838  pj_o(pj);
839  pj_ks(pj, "type", "mem_write");
840  pj_ks(pj, "address", tmp0);
841  pj_ks(pj, "old", tmp1 ? tmp1 : "uninitialized memory");
842  pj_ks(pj, "new", tmp2);
843  pj_end(pj);
844  break;
846  tmp1 = rz_il_value_stringify(evt->data.var_write.old_value);
847  tmp2 = rz_il_value_stringify(evt->data.var_write.new_value);
848  pj_o(pj);
849  pj_ks(pj, "type", "var_write");
850  pj_ks(pj, "name", evt->data.var_write.variable);
851  pj_ks(pj, "old", tmp1 ? tmp1 : "uninitialized variable");
852  pj_ks(pj, "new", tmp2);
853  pj_end(pj);
854  break;
855  default:
857  pj_o(pj);
858  pj_ks(pj, "type", "unknown");
859  pj_end(pj);
860  break;
861  }
862 
863  free(tmp0);
864  free(tmp1);
865  free(tmp2);
866 }
RZ_API char * rz_il_value_stringify(RZ_NONNULL const RzILVal *val)
Definition: il_export.c:739
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
RZ_API RZ_OWN char * rz_bv_as_hex_string(RZ_NONNULL RzBitVector *bv, bool pad)
Definition: bitvector.c:121
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170

References free(), NULL, pj_end(), pj_ks(), pj_o(), rz_bv_as_hex_string(), RZ_IL_EVENT_EXCEPTION, RZ_IL_EVENT_MEM_READ, RZ_IL_EVENT_MEM_WRITE, RZ_IL_EVENT_PC_WRITE, RZ_IL_EVENT_VAR_READ, RZ_IL_EVENT_VAR_WRITE, rz_il_value_stringify(), rz_return_if_fail, and rz_warn_if_reached.

Referenced by rz_core_analysis_il_step_with_events().

◆ rz_il_event_mem_read_new()

RZ_API RZ_OWN RzILEvent* rz_il_event_mem_read_new ( RZ_NONNULL const RzBitVector address,
RZ_NULLABLE const RzBitVector value 
)

Creates an RzILEvent of type RZ_IL_EVENT_MEM_READ

Parameters
addr,RzBitVector,addressof the memory where the read op has occurred
value,RzBitVector,valueread from the variable

Definition at line 100 of file il_events.c.

100  {
101  rz_return_val_if_fail(address && value, NULL);
102 
103  RzILEvent *evt = RZ_NEW(RzILEvent);
104  if (!evt) {
105  return NULL;
106  }
107 
108  evt->type = RZ_IL_EVENT_MEM_READ;
109  evt->data.mem_read.address = rz_bv_dup(address);
111  if (!evt->data.mem_read.address || !evt->data.mem_read.value) {
112  rz_il_event_free(evt);
113  return NULL;
114  }
115 
116  return evt;
117 }
static int value
Definition: cmd_api.c:93
RZ_API RZ_OWN RzBitVector * rz_bv_dup(const RZ_NONNULL RzBitVector *bv)
Definition: bitvector.c:167
RZ_NONNULL RzBitVector * value
Definition: rz_il_events.h:30
RZ_NONNULL RzBitVector * address
Definition: rz_il_events.h:29
RzILEventMemRead mem_read
Definition: rz_il_events.h:60

References rz_il_vm_event_mem_read_t::address, rz_il_vm_event_t::data, rz_il_vm_event_t::mem_read, NULL, rz_bv_dup(), rz_il_event_free(), RZ_IL_EVENT_MEM_READ, RZ_NEW, rz_return_val_if_fail, rz_il_vm_event_t::type, value, and rz_il_vm_event_mem_read_t::value.

Referenced by rz_il_vm_mem_load(), and rz_il_vm_mem_loadw().

◆ rz_il_event_mem_write_new()

RZ_API RZ_OWN RzILEvent* rz_il_event_mem_write_new ( RZ_NONNULL const RzBitVector addr,
RZ_NONNULL const RzBitVector old_v,
RZ_NONNULL const RzBitVector new_v 
)

Creates an RzILEvent of type RZ_IL_EVENT_MEM_WRITE

Parameters
addr,RzBitVector,addressof the memory that has changed
old_v,RzBitVector,oldvalue before the change
new_v,RzBitVector,newvalue after the change

Definition at line 125 of file il_events.c.

125  {
126  rz_return_val_if_fail(addr && old_v && new_v, NULL);
127 
128  RzILEvent *evt = RZ_NEW(RzILEvent);
129  if (!evt) {
130  return NULL;
131  }
132 
135  evt->data.mem_write.old_value = rz_bv_dup(old_v);
136  evt->data.mem_write.new_value = rz_bv_dup(new_v);
137  if (!evt->data.mem_write.address ||
138  !evt->data.mem_write.old_value ||
139  !evt->data.mem_write.new_value) {
140  rz_il_event_free(evt);
141  return NULL;
142  }
143 
144  return evt;
145 }
RZ_NONNULL RzBitVector * old_value
Definition: rz_il_events.h:45
RZ_NONNULL RzBitVector * address
Definition: rz_il_events.h:44
RZ_NONNULL RzBitVector * new_value
Definition: rz_il_events.h:46
RzILEventMemWrite mem_write
Definition: rz_il_events.h:61
static int addr
Definition: z80asm.c:58

References addr, rz_il_vm_event_mem_write_t::address, rz_il_vm_event_t::data, rz_il_vm_event_t::mem_write, rz_il_vm_event_mem_write_t::new_value, NULL, rz_il_vm_event_mem_write_t::old_value, rz_bv_dup(), rz_il_event_free(), RZ_IL_EVENT_MEM_WRITE, RZ_NEW, rz_return_val_if_fail, and rz_il_vm_event_t::type.

Referenced by rz_il_vm_mem_store(), and rz_il_vm_mem_storew().

◆ rz_il_event_pc_write_new()

RZ_API RZ_OWN RzILEvent* rz_il_event_pc_write_new ( RZ_NONNULL const RzBitVector old_pc,
RZ_NONNULL const RzBitVector new_pc 
)

Creates an RzILEvent of type RZ_IL_EVENT_PC_WRITE

Parameters
old_pc,RzBitVector,oldprogram counter value before the change
new_pc,RzBitVector,newprogram counter value after the change

Definition at line 76 of file il_events.c.

76  {
77  rz_return_val_if_fail(old_pc && new_pc, NULL);
78 
79  RzILEvent *evt = RZ_NEW(RzILEvent);
80  if (!evt) {
81  return NULL;
82  }
83 
85  evt->data.pc_write.old_pc = rz_bv_dup(old_pc);
86  evt->data.pc_write.new_pc = rz_bv_dup(new_pc);
87  if (!evt->data.pc_write.old_pc || !evt->data.pc_write.new_pc) {
88  rz_il_event_free(evt);
89  return NULL;
90  }
91 
92  return evt;
93 }
RzILEventPCWrite pc_write
Definition: rz_il_events.h:59

References rz_il_vm_event_t::data, rz_il_vm_event_pc_write_t::new_pc, NULL, rz_il_vm_event_pc_write_t::old_pc, rz_il_vm_event_t::pc_write, rz_bv_dup(), rz_il_event_free(), RZ_IL_EVENT_PC_WRITE, RZ_NEW, rz_return_val_if_fail, and rz_il_vm_event_t::type.

Referenced by perform_jump(), and rz_il_vm_step().

◆ rz_il_event_stringify()

RZ_API void rz_il_event_stringify ( RZ_NONNULL const RzILEvent evt,
RZ_NONNULL RzStrBuf sb 
)

Create a readable string representation of evt

Definition at line 753 of file il_export.c.

753  {
754  rz_return_if_fail(evt && sb);
755  char *tmp0 = NULL, *tmp1 = NULL, *tmp2 = NULL;
756 
757  switch (evt->type) {
759  rz_strbuf_appendf(sb, "exception(%s)", evt->data.exception);
760  break;
762  tmp0 = rz_bv_as_hex_string(evt->data.pc_write.old_pc, false);
763  tmp1 = rz_bv_as_hex_string(evt->data.pc_write.new_pc, false);
764  rz_strbuf_appendf(sb, "pc_write(old: %s, new: %s)", tmp0, tmp1);
765  break;
767  tmp0 = rz_bv_as_hex_string(evt->data.mem_read.address, false);
768  tmp1 = evt->data.mem_read.value ? rz_bv_as_hex_string(evt->data.mem_read.value, false) : NULL;
769  rz_strbuf_appendf(sb, "mem_read(addr: %s, value: %s)", tmp0, tmp1 ? tmp1 : "uninitialized memory");
770  break;
772  tmp1 = rz_il_value_stringify(evt->data.var_read.value);
773  rz_strbuf_appendf(sb, "var_read(name: %s, value: %s)", evt->data.var_write.variable, tmp1 ? tmp1 : "uninitialized variable");
774  break;
776  tmp0 = rz_bv_as_hex_string(evt->data.mem_write.address, false);
777  tmp1 = evt->data.mem_write.old_value ? rz_bv_as_hex_string(evt->data.mem_write.old_value, false) : NULL;
778  tmp2 = rz_bv_as_hex_string(evt->data.mem_write.new_value, false);
779  rz_strbuf_appendf(sb, "mem_write(addr: %s, old: %s, new: %s)", tmp0, tmp1 ? tmp1 : "uninitialized memory", tmp2);
780  break;
782  tmp1 = rz_il_value_stringify(evt->data.var_write.old_value);
783  tmp2 = rz_il_value_stringify(evt->data.var_write.new_value);
784  rz_strbuf_appendf(sb, "var_write(name: %s, old: %s, new: %s)", evt->data.var_write.variable, tmp1 ? tmp1 : "uninitialized variable", tmp2);
785  break;
786  default:
788  rz_strbuf_append(sb, "unknown(?)");
789  break;
790  }
791 
792  free(tmp0);
793  free(tmp1);
794  free(tmp2);
795 }
static SblHeader sb
Definition: bin_mbn.c:26
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
Definition: strbuf.c:222
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2

References free(), NULL, rz_bv_as_hex_string(), RZ_IL_EVENT_EXCEPTION, RZ_IL_EVENT_MEM_READ, RZ_IL_EVENT_MEM_WRITE, RZ_IL_EVENT_PC_WRITE, RZ_IL_EVENT_VAR_READ, RZ_IL_EVENT_VAR_WRITE, rz_il_value_stringify(), rz_return_if_fail, rz_strbuf_append(), rz_strbuf_appendf(), rz_warn_if_reached, and sb.

Referenced by rz_core_analysis_il_step_with_events().

◆ rz_il_event_var_read_new()

RZ_API RZ_OWN RzILEvent* rz_il_event_var_read_new ( RZ_NONNULL const char *  name,
RZ_NULLABLE const RzILVal value 
)

Creates an RzILEvent of type RZ_IL_EVENT_VAR_READ

Parameters
nameregister name that has changed
valuevalue read from the variable

Definition at line 152 of file il_events.c.

152  {
154 
155  RzILEvent *evt = RZ_NEW(RzILEvent);
156  if (!evt) {
157  return NULL;
158  }
159 
160  evt->type = RZ_IL_EVENT_VAR_READ;
161  evt->data.var_read.variable = strdup(name);
163  if (!evt->data.var_read.variable || !evt->data.var_read.value) {
164  rz_il_event_free(evt);
165  return NULL;
166  }
167 
168  return evt;
169 }
RZ_API RZ_OWN RzILVal * rz_il_value_dup(RZ_NONNULL const RzILVal *val)
Definition: value.c:85
Definition: z80asm.h:102
RzILEventVarRead var_read
Definition: rz_il_events.h:62
RZ_NONNULL char * variable
Definition: rz_il_events.h:34
RZ_NONNULL RzILVal * value
Definition: rz_il_events.h:35

References rz_il_vm_event_t::data, NULL, rz_il_event_free(), RZ_IL_EVENT_VAR_READ, rz_il_value_dup(), RZ_NEW, rz_return_val_if_fail, strdup(), rz_il_vm_event_t::type, value, rz_il_vm_event_var_read_t::value, rz_il_vm_event_t::var_read, and rz_il_vm_event_var_read_t::variable.

Referenced by rz_il_handler_var().

◆ rz_il_event_var_write_new()

RZ_API RZ_OWN RzILEvent* rz_il_event_var_write_new ( RZ_NONNULL const char *  name,
RZ_NULLABLE const RzILVal old_v,
RZ_NONNULL const RzILVal new_v 
)

Creates an RzILEvent of type RZ_IL_EVENT_VAR_WRITE

Parameters
nameregister name that has changed
old_vold value before the change
new_vnew value after the change

Definition at line 177 of file il_events.c.

177  {
178  rz_return_val_if_fail(name && old_v && new_v, NULL);
179 
180  RzILEvent *evt = RZ_NEW(RzILEvent);
181  if (!evt) {
182  return NULL;
183  }
184 
187  evt->data.var_write.old_value = rz_il_value_dup(old_v);
188  evt->data.var_write.new_value = rz_il_value_dup(new_v);
189  if (!evt->data.var_write.variable ||
190  !evt->data.var_write.old_value ||
191  !evt->data.var_write.new_value) {
192  rz_il_event_free(evt);
193  return NULL;
194  }
195 
196  return evt;
197 }
RzILEventVarWrite var_write
Definition: rz_il_events.h:63
RZ_NONNULL RzILVal * new_value
Definition: rz_il_events.h:52
RZ_NONNULL RzILVal * old_value
Definition: rz_il_events.h:51
RZ_NONNULL char * variable
Definition: rz_il_events.h:50

References rz_il_vm_event_t::data, rz_il_vm_event_var_write_t::new_value, NULL, rz_il_vm_event_var_write_t::old_value, rz_il_event_free(), RZ_IL_EVENT_VAR_WRITE, rz_il_value_dup(), RZ_NEW, rz_return_val_if_fail, strdup(), rz_il_vm_event_t::type, rz_il_vm_event_t::var_write, and rz_il_vm_event_var_write_t::variable.

Referenced by il_event_new_write_from_var().