summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorjaortega <jaortega>2001-02-14 22:10:35 +0000
committerjaortega <jaortega>2001-02-14 22:10:35 +0000
commit94ec6053894ffb8c8d459f5a9944e5104c2395e1 (patch)
treec14be2a20dfd53f1494cb5ce7e817086b3b87d26 /mixlib
parent8b5ec0cb95cf8252189dd5c2ced769c472cbdaac (diff)
downloadmdk-94ec6053894ffb8c8d459f5a9944e5104c2395e1.tar.gz
mdk-94ec6053894ffb8c8d459f5a9944e5104c2395e1.tar.bz2
(mix_vm_get_address_lineno) new function
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_vm.c15
-rw-r--r--mixlib/mix_vm.h6
2 files changed, 19 insertions, 2 deletions
diff --git a/mixlib/mix_vm.c b/mixlib/mix_vm.c
index 3745c19..979d558 100644
--- a/mixlib/mix_vm.c
+++ b/mixlib/mix_vm.c
@@ -1,7 +1,7 @@
/* -*-c-*- ------------------ mix_vm.c :
* Implementation of the functions declared in mix_vm.h
* ------------------------------------------------------------------
- * Copyright (C) 2000 jose antonio ortega ruiz <jaortega@acm.org>
+ * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -311,6 +311,19 @@ mix_vm_get_prog_count (const mix_vm_t *vm)
return get_loc_ (vm);
}
+/* Get the source line number for a given address */
+guint
+mix_vm_get_address_lineno (const mix_vm_t *vm, mix_address_t addr)
+{
+ gpointer gp_addr = GUINT_TO_POINTER ((guint)addr);
+ guint lineno;
+
+ g_return_val_if_fail (vm != NULL, 0);
+ g_return_val_if_fail (MEMOK_ (addr), 0);
+ lineno = GPOINTER_TO_UINT (g_tree_lookup (vm->address_table, gp_addr));
+ return lineno;
+}
+
/* Reposition program counter and reset state so that a loaded
program can be restarted.
*/
diff --git a/mixlib/mix_vm.h b/mixlib/mix_vm.h
index 91d1d28..ac734d7 100644
--- a/mixlib/mix_vm.h
+++ b/mixlib/mix_vm.h
@@ -1,7 +1,7 @@
/* ---------------------- mix_vm.h :
* Types and functions implementing the MIX virtual machine
* ------------------------------------------------------------------
- * Copyright (C) 2000 jose antonio ortega ruiz <jaortega@acm.org>
+ * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -128,6 +128,10 @@ mix_vm_get_symbol_table (const mix_vm_t *vm);
extern mix_address_t
mix_vm_get_prog_count (const mix_vm_t *vm);
+/* Get the source line number for a given address */
+extern guint
+mix_vm_get_address_lineno (const mix_vm_t *vm, mix_address_t addr);
+
/* Reposition program counter and reset state so that a loaded
program can be restarted.
*/