aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1996-03-30 05:45:10 +0000
committerFred Fish <fnf@specifix.com>1996-03-30 05:45:10 +0000
commitb52cac6b76cd1f1662d62c630a5aabc13a70dfb8 (patch)
tree01b54646cb219f69691407e35a56d38bf3d29abc /gdb/findvar.c
parent84f737e989e2b78123361fc22d309c32eb96098e (diff)
downloadgdb-b52cac6b76cd1f1662d62c630a5aabc13a70dfb8.zip
gdb-b52cac6b76cd1f1662d62c630a5aabc13a70dfb8.tar.gz
gdb-b52cac6b76cd1f1662d62c630a5aabc13a70dfb8.tar.bz2
* core-aout.c (fetch_core_registers): Cast core_reg_size to int
before testing against reg_ptr. * eval.c (evaluate_subexp_standard): Cast type of TYPE_FN_FIELD_VOFFSET to int. * findvar.c (extract_signed_integer, extract_unsigned_integer, extract_long_unsigned_integer): Cast type of sizeof to int. * values.c (unpack_field_as_long, modify_field): Ditto. * valops.c (value_assign, call_function_by_hand): Ditto. * infcmd.c (do_registers_info): Ditto. * ser-tcp.c (tcp_open): Ditto * remote.c (putpkt): Ditto. * dcache.c (dcache_peek): Ditto. * dcache.c (dcache_poke): Ditto. * m2-exp.y (yylex): Ditto. * gnu-regex.c (re_match_2): Ditto. * f-lang.c (ADD_BF_SYMNUM, saved_bf_list_end, tmp_bf_ptr): Ifdef out unused macro definition and variables. * inftarg.c (proc_wait): Move from main.c to here, and make static. * valprint.c (val_print_string): Change bufsize from int to unsigned. * main.c (wait.h): Include * top.c (command_line_input): Remove unused variable "c". * f-typeprint.c (f_type_print_varspec_prefix): Add missing enum value TYPE_CODE_TYPEDEF to switch statement. (f_type_print_varspec_suffix): Add missing enum value TYPE_CODE_TYPEDEF to switch statement. * ch-exp.c (parse_primval): Add remaining enumeration values to switch statement, with no specific action. (ch_lex): Add LOC_UNRESOLVED in switch statement. (pushback_token): Ifdef out, since code using it is ifdef'd out. * stabsread.c (cleanup_undefined_types): Remove unused label "badtype". * objfiles.h (print_symbol_bcache_statistics): Add prototype. * maint.c (objfiles.h): Include. (maintenance_print_statistics): Remove unused variable "temp". * minsyms.c (lookup_minimal_symbol_solib_trampoline): Remove unused variable "found_file_symbol". * m2-exp.y (yylex): Add LOC_UNRESOLVED case to switch. * language.c (lang_bool_type): Use existing function local type variable rather than create block local variables. * solib.c (disable_break): Enclose in ifndef SVR4_SHARED_LIBS. * infptrace.c (wait.h, command.h): Include. * ser-tcp.c (gdb_string.h): Include * i386-tdep.c (codestream_seek): Change "place" to CORE_ADDR. (i386_get_frame_setup): Change "pc" from int to CORE_ADDR. * command.c (complete_on_enum): Make assignment used as truth value explictly check against NULL. (wait.h): Include. * infrun.c (wait_for_inferior): Ifdef out prologue_pc since code that uses it is ifdef'd out. * parser-defs.h: Add prototype for write_dollar_variable. * infrun.c: Add prototype for write_pc_pid. * breakpoint.h: Add prototype for re_enable_breakpoints_in_shlibs. * symmisc.c (bcache.h): Include. * bcache.h: Add prototype for print_bcache_statistics. * symfile.c: Include <time.h>. * printcmd.c (print_scalar_formatted): Change len to unsigned int. * valarith.c (value_equal): Cast result of TYPE_LENGTH to int. * valarith.c (value_binop): Change result_len, promoted_len1, and promoted_len2 to unsigned int. * valarith.c (value_subscripted_rvalue): Change elt_offs and elt_size to unsigned int. * valops.c (value_array): Change typelength to unsigned int. (destructor_name_p): Change len to unsigned int. * scm-lang.h (scm_parse): Add prototype for scm_unpack. * symfile.c (decrement_reading_symtab): Change return type to void. * valarith.c (value_subscript): Remove unused variable "word". (value_subscript): Remove unused variable "tint". * valops.c (auto_abandon): Ifdef out, since code using it is also ifdef'd out. * eval.c (init_array_element): Remove unused variable "val". * Makefile.in (values.o): Depends on scm-lang.h. (command.o): Depends upon wait_h. (ser-tcp.o): Depends upon gdb_string.h. (infptrace.o): Depends upon wait_h and command_h. (maint.o): Depends on objfiles.h and symfile.h. * values.c (allocate_repeat_value): Remove unused variable "element_type". (scm-lang.h): Include. * breakpoint.c (create_longjmp_breakpoint): Enclose in GET_LONGJMP_TARGET define, unused otherwise. * config/i386/nm-linux.h: Add prototypes for i386_insert_watchpoint, i386_remove_watchpoint and i386_stopped_by_watchpoint.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c64
1 files changed, 58 insertions, 6 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index f0f46d6..1dce905 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -1,5 +1,5 @@
/* Find a variable's value in memory, for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1994, 1995 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,7 +55,7 @@ extract_signed_integer (addr, len)
unsigned char *startaddr = (unsigned char *)addr;
unsigned char *endaddr = startaddr + len;
- if (len > sizeof (LONGEST))
+ if (len > (int) sizeof (LONGEST))
error ("\
That operation is not available on integers of more than %d bytes.",
sizeof (LONGEST));
@@ -91,7 +91,7 @@ extract_unsigned_integer (addr, len)
unsigned char *startaddr = (unsigned char *)addr;
unsigned char *endaddr = startaddr + len;
- if (len > sizeof (unsigned LONGEST))
+ if (len > (int) sizeof (unsigned LONGEST))
error ("\
That operation is not available on integers of more than %d bytes.",
sizeof (unsigned LONGEST));
@@ -112,6 +112,58 @@ That operation is not available on integers of more than %d bytes.",
return retval;
}
+/* Sometimes a long long unsigned integer can be extracted as a
+ LONGEST value. This is done so that we can print these values
+ better. If this integer can be converted to a LONGEST, this
+ function returns 1 and sets *PVAL. Otherwise it returns 0. */
+
+int
+extract_long_unsigned_integer (addr, orig_len, pval)
+ PTR addr;
+ int orig_len;
+ LONGEST *pval;
+{
+ char *p, *first_addr;
+ int len;
+
+ len = orig_len;
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ {
+ for (p = (char *) addr;
+ len > (int) sizeof (LONGEST) && p < (char *) addr + orig_len;
+ p++)
+ {
+ if (*p == 0)
+ len--;
+ else
+ break;
+ }
+ first_addr = p;
+ }
+ else
+ {
+ first_addr = (char *) addr;
+ for (p = (char *) addr + orig_len - 1;
+ len > (int) sizeof (LONGEST) && p >= (char *) addr;
+ p--)
+ {
+ if (*p == 0)
+ len--;
+ else
+ break;
+ }
+ }
+
+ if (len <= (int) sizeof (LONGEST))
+ {
+ *pval = (LONGEST) extract_unsigned_integer (first_addr,
+ sizeof (LONGEST));
+ return 1;
+ }
+
+ return 0;
+}
+
CORE_ADDR
extract_address (addr, len)
PTR addr;
@@ -247,9 +299,9 @@ extract_floating (addr, len)
SWAP_FLOATING (&retval, sizeof (retval));
return retval;
}
- else if (len == sizeof (long double))
+ else if (len == sizeof (DOUBLEST))
{
- long double retval;
+ DOUBLEST retval;
memcpy (&retval, addr, sizeof (retval));
SWAP_FLOATING (&retval, sizeof (retval));
return retval;
@@ -279,7 +331,7 @@ store_floating (addr, len, val)
SWAP_FLOATING (&doubleval, sizeof (doubleval));
memcpy (addr, &doubleval, sizeof (doubleval));
}
- else if (len == sizeof (long double))
+ else if (len == sizeof (DOUBLEST))
{
SWAP_FLOATING (&val, sizeof (val));
memcpy (addr, &val, sizeof (val));