summaryrefslogtreecommitdiffhomepage
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/vm.c b/vm.c
index 99e07bb..82d2f1c 100644
--- a/vm.c
+++ b/vm.c
@@ -14,7 +14,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
@@ -137,13 +136,9 @@ uc_vm_output_exception(uc_vm *vm, uc_exception *ex);
void uc_vm_init(uc_vm *vm, uc_parse_config *config)
{
- char *s = getenv("TRACE");
-
vm->exception.type = EXCEPTION_NONE;
vm->exception.message = NULL;
- vm->trace = s ? strtoul(s, NULL, 0) : 0;
-
vm->config = config;
vm->open_upvals = NULL;
@@ -160,6 +155,8 @@ void uc_vm_init(uc_vm *vm, uc_parse_config *config)
uc_vm_alloc_global_scope(vm);
uc_vm_exception_handler_set(vm, uc_vm_output_exception);
+
+ uc_vm_trace_set(vm, 0);
}
void uc_vm_free(uc_vm *vm)
@@ -2409,3 +2406,15 @@ uc_vm_exception_handler_set(uc_vm *vm, uc_exception_handler_t *exhandler)
{
vm->exhandler = exhandler;
}
+
+uint32_t
+uc_vm_trace_get(uc_vm *vm)
+{
+ return vm->trace;
+}
+
+void
+uc_vm_trace_set(uc_vm *vm, uint32_t level)
+{
+ vm->trace = level;
+}