summaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorpmuldoon <pmuldoon>2010-06-28 21:16:01 +0000
committerpmuldoon <pmuldoon>2010-06-28 21:16:01 +0000
commit1371a50ec70573353e400b3a0075cfff12edfe87 (patch)
tree161037f5740b13f5ff5f63c4b8137f045eb77f94 /gdb/value.c
parent758a1f7149cb7469c7e6bb30cb572715ee90a6e8 (diff)
downloadgdb-1371a50ec70573353e400b3a0075cfff12edfe87.tar.gz
2010-06-28 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com> Thiago Jung Bauermann <bauerman@br.ibm.com> * value.c (pack_unsigned_long): New function. (value_from_ulongest): New function. * value.h (value_from_ulongest): Declare. * python/python.c (_initialize_python): Call gdbpy_initialize_thread and gdbpy_initialize_inferior. * python/python-internal.h: Define thread_object. (gdbpy_inferiors, gdbpy_selected_thread) (frame_info_to_frame_object, create_thread_object) (find_thread_object, find_inferior_object) (gdbpy_initialize_thread, gdbpy_initialize_inferiors) (gdbpy_is_value_object, get_addr_from_python): Declare. * python/py-value.c (builtin_type_upylong): Define. (convert_value_from_python): Add logic for ulongest. (gdbpy_is_value_object): New function. * python/py-utils.c (get_addr_from_python): New function. * python/py-frame.c (frame_info_to_frame_object): Return a PyObject. (gdbpy_selected_frame): Use PyObject over frame_info. * Makefile.in (SUBDIR_PYTHON_OBS): Add py-inferior and py-infthread. (SUBDIR_PYTHON_SRCS): Likewise. (py-inferior.o): New Rule. (py-infthread.o): New Rule. * python/py-inferior.c: New File. * python/py-infthread.c: New File. 2010-06-28 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> Thiago Jung Bauermann <bauerman@br.ibm.com> * gdb.texinfo (Inferiors In Python): New node. * gdb.texinfo (Threads In Python): New node. 2010-06-28 Phil Muldoon <pmuldoon@redhat.com> Tom Tromey <tromey@redhat.com> Thiago Jung Bauermann <bauerman@br.ibm.com> * gdb.python/py-inferior.c: New File. * gdb.python/py-infthread.c: New File. * gdb.python/py-inferior.exp: New File. * gdb.python/py-infthread.exp: New File.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 1c0bc57792c..64ac5635636 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2250,6 +2250,43 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
}
+/* Pack NUM into BUF using a target format of TYPE. */
+
+void
+pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num)
+{
+ int len;
+ enum bfd_endian byte_order;
+
+ type = check_typedef (type);
+ len = TYPE_LENGTH (type);
+ byte_order = gdbarch_byte_order (get_type_arch (type));
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_INT:
+ case TYPE_CODE_CHAR:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_FLAGS:
+ case TYPE_CODE_BOOL:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_MEMBERPTR:
+ store_unsigned_integer (buf, len, byte_order, num);
+ break;
+
+ case TYPE_CODE_REF:
+ case TYPE_CODE_PTR:
+ store_typed_address (buf, type, (CORE_ADDR) num);
+ break;
+
+ default:
+ error (_("\
+Unexpected type (%d) encountered for unsigned integer constant."),
+ TYPE_CODE (type));
+ }
+}
+
+
/* Convert C numbers into newly allocated values. */
struct value *
@@ -2262,6 +2299,19 @@ value_from_longest (struct type *type, LONGEST num)
}
+/* Convert C unsigned numbers into newly allocated values. */
+
+struct value *
+value_from_ulongest (struct type *type, ULONGEST num)
+{
+ struct value *val = allocate_value (type);
+
+ pack_unsigned_long (value_contents_raw (val), type, num);
+
+ return val;
+}
+
+
/* Create a value representing a pointer of type TYPE to the address
ADDR. */
struct value *