diff options
author | Mark Kettenis <kettenis@gnu.org> | 2005-07-12 13:06:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2005-07-12 13:06:54 +0000 |
commit | 852483bc793b005fc6a7cad8bb6a15846fe7ef25 (patch) | |
tree | 245dcaded679cc857d24048d5f07b0a90b154eb6 | |
parent | 22a44745e3c45871c3124196752c5b7bf0c593e3 (diff) | |
download | gdb-852483bc793b005fc6a7cad8bb6a15846fe7ef25.zip gdb-852483bc793b005fc6a7cad8bb6a15846fe7ef25.tar.gz gdb-852483bc793b005fc6a7cad8bb6a15846fe7ef25.tar.bz2 |
* dwarf2expr.h: Tweak comment.
(struct dwarf_expr_context): Use `gdb_byte *' in read_mem and
get_frame_base function pointers.
(read_uleb128, read_sleb128): Change return type and types of
first two arguments to `gdb_byte *'.
(dwarf2_read_address): Change types of first two arguments to
`gdb_byte *'.
* dwarf2expr.c: Tweak comment.
(dwarf_expr_eval): Change type of second argument to `gdb_byte *'.
(read_uleb128, read_sleb128): Change return type and types of
first two arguments to `gdb_byte *'.
(dwarf2_read_address): Change types of first two arguments to
`gdb_byte *'.
(execute_stack_op): Change types of last two arguments to
`gdb_byte *'. Use `gdb_byte *' for byte buffers.
* dwarf2loc.h: Tweak comment.
(struct dwarf2_locexpr_baton, struct dwarf2_loclist_baton): Use
`gdb_byte *' for byte buffers.
* dwarf2loc.c (find_location_expression): Change return type to
`gdb_byte *'. Use `gdb_byte *' for byte buffers. Change length
to `unsigned int'.
(dwarf_expr_read_reg): Use `gdb_byte *' for byte buffer. Remove
bogus cast.
(dwarf_expr_read_mem): Change type of second argument to
`gdb_byte *'.
(dwarf_expr_frame_base): Change type of second argument to
`gdb_byte **'.
(dwarf2_evaluate_loc_desc): Change type of third argument to
`gdb_byte *'.
(needs_frame_read_mem): Change type of second argument to
`gdb_byte *'.
(needs_frame_frame_base): Change type of second argument
`gdb_byte **'. Use gdb_byte for lit0.
(dwarf2_tracepoint_var_ref): Change type of fourth argument to
`gdb_byte *'. Use `gdb_byte *' for byte buffer.
(loclist_read_variable, loclist_tracepoint_var_ref): Use `gdb_byte
*' for byte buffer.
* dwarf2-frame.c (struct dwarf2_cie, struct dwarf2_fde)
(struct dwarf2_frame_state): Use gdb_byte instead of `unsigned
char'.
(read_reg): Use `gdb_byte *' for byte buffers. Remove redundant
cast.
(read_mem): Change second argument to `gdb_byte *'.
(no_get_frame_base): Change second argument to `gdb_byte **'.
(execute_stack_op): Change first argument to `gdb_byte *'.
(execute_cfa_program): Change first two arguments to `gdb_byte *'.
Use gdb_byte instead of `unsigned int'. Use temprorary variable
to store result of read_uleb128.
(struct comp_unit): Use `gdb_byte *' for byte buffers.
(read_1_byte, read_4_bytes, read_8_bytes): Change last argument to
`gdb_byte *'.
(read_unsigned_leb128, read_signed_leb128): Change second argument
to `gdb_byte *'. Use gdb_byte instead of `unsigned char'.
(read_initial_length): Change second argument to `gdb_byte *'.
Remove redundant casts.
(read_encoded_value): Use gdb_byte instead of `unsigned char'.
Remove bogus casts.
(decode_frame_entry_1): Change return type and second argument to
`gdb_byte *'. Use `gdb_byte *' for byte buffers. Use gdb_byte
instead of `unsigned char'.
(decode_frame_entry): Change return type and second argument to
`gdb_byte *'. Use `gdb_byte *' for byte buffers.
(dwarf2_build_frame_info): Use `gdb_byte *' for byte buffers.
-rw-r--r-- | gdb/ChangeLog | 66 | ||||
-rw-r--r-- | gdb/dwarf2-frame.c | 98 | ||||
-rw-r--r-- | gdb/dwarf2expr.c | 35 | ||||
-rw-r--r-- | gdb/dwarf2expr.h | 25 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 35 | ||||
-rw-r--r-- | gdb/dwarf2loc.h | 11 |
6 files changed, 169 insertions, 101 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 780d02a..915357f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,69 @@ +2005-07-12 Mark Kettenis <kettenis@openbsd.localdomain> + + * dwarf2expr.h: Tweak comment. + (struct dwarf_expr_context): Use `gdb_byte *' in read_mem and + get_frame_base function pointers. + (read_uleb128, read_sleb128): Change return type and types of + first two arguments to `gdb_byte *'. + (dwarf2_read_address): Change types of first two arguments to + `gdb_byte *'. + * dwarf2expr.c: Tweak comment. + (dwarf_expr_eval): Change type of second argument to `gdb_byte *'. + (read_uleb128, read_sleb128): Change return type and types of + first two arguments to `gdb_byte *'. + (dwarf2_read_address): Change types of first two arguments to + `gdb_byte *'. + (execute_stack_op): Change types of last two arguments to + `gdb_byte *'. Use `gdb_byte *' for byte buffers. + * dwarf2loc.h: Tweak comment. + (struct dwarf2_locexpr_baton, struct dwarf2_loclist_baton): Use + `gdb_byte *' for byte buffers. + * dwarf2loc.c (find_location_expression): Change return type to + `gdb_byte *'. Use `gdb_byte *' for byte buffers. Change length + to `unsigned int'. + (dwarf_expr_read_reg): Use `gdb_byte *' for byte buffer. Remove + bogus cast. + (dwarf_expr_read_mem): Change type of second argument to + `gdb_byte *'. + (dwarf_expr_frame_base): Change type of second argument to + `gdb_byte **'. + (dwarf2_evaluate_loc_desc): Change type of third argument to + `gdb_byte *'. + (needs_frame_read_mem): Change type of second argument to + `gdb_byte *'. + (needs_frame_frame_base): Change type of second argument + `gdb_byte **'. Use gdb_byte for lit0. + (dwarf2_tracepoint_var_ref): Change type of fourth argument to + `gdb_byte *'. Use `gdb_byte *' for byte buffer. + (loclist_read_variable, loclist_tracepoint_var_ref): Use `gdb_byte + *' for byte buffer. + * dwarf2-frame.c (struct dwarf2_cie, struct dwarf2_fde) + (struct dwarf2_frame_state): Use gdb_byte instead of `unsigned + char'. + (read_reg): Use `gdb_byte *' for byte buffers. Remove redundant + cast. + (read_mem): Change second argument to `gdb_byte *'. + (no_get_frame_base): Change second argument to `gdb_byte **'. + (execute_stack_op): Change first argument to `gdb_byte *'. + (execute_cfa_program): Change first two arguments to `gdb_byte *'. + Use gdb_byte instead of `unsigned int'. Use temprorary variable + to store result of read_uleb128. + (struct comp_unit): Use `gdb_byte *' for byte buffers. + (read_1_byte, read_4_bytes, read_8_bytes): Change last argument to + `gdb_byte *'. + (read_unsigned_leb128, read_signed_leb128): Change second argument + to `gdb_byte *'. Use gdb_byte instead of `unsigned char'. + (read_initial_length): Change second argument to `gdb_byte *'. + Remove redundant casts. + (read_encoded_value): Use gdb_byte instead of `unsigned char'. + Remove bogus casts. + (decode_frame_entry_1): Change return type and second argument to + `gdb_byte *'. Use `gdb_byte *' for byte buffers. Use gdb_byte + instead of `unsigned char'. + (decode_frame_entry): Change return type and second argument to + `gdb_byte *'. Use `gdb_byte *' for byte buffers. + (dwarf2_build_frame_info): Use `gdb_byte *' for byte buffers. + 2005-07-12 Mark Kettenis <kettenis@gnu.org> * objc-lang.c (print_object_command): Use gdb_byte for c. diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index a7d27a7..945d216 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -60,11 +60,11 @@ struct dwarf2_cie ULONGEST return_address_register; /* Instruction sequence to initialize a register set. */ - unsigned char *initial_instructions; - unsigned char *end; + gdb_byte *initial_instructions; + gdb_byte *end; /* Encoding of addresses. */ - unsigned char encoding; + gdb_byte encoding; /* True if a 'z' augmentation existed. */ unsigned char saw_z_augmentation; @@ -86,8 +86,8 @@ struct dwarf2_fde CORE_ADDR address_range; /* Instruction sequence. */ - unsigned char *instructions; - unsigned char *end; + gdb_byte *instructions; + gdb_byte *end; struct dwarf2_fde *next; }; @@ -112,7 +112,7 @@ struct dwarf2_frame_state LONGEST cfa_offset; ULONGEST cfa_reg; - unsigned char *cfa_exp; + gdb_byte *cfa_exp; enum { CFA_UNSET, CFA_REG_OFFSET, @@ -208,23 +208,23 @@ read_reg (void *baton, int reg) struct frame_info *next_frame = (struct frame_info *) baton; struct gdbarch *gdbarch = get_frame_arch (next_frame); int regnum; - char *buf; + gdb_byte *buf; regnum = DWARF2_REG_TO_REGNUM (reg); - buf = (char *) alloca (register_size (gdbarch, regnum)); + buf = alloca (register_size (gdbarch, regnum)); frame_unwind_register (next_frame, regnum, buf); return extract_typed_address (buf, builtin_type_void_data_ptr); } static void -read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len) +read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len) { read_memory (addr, buf, len); } static void -no_get_frame_base (void *baton, unsigned char **start, size_t *length) +no_get_frame_base (void *baton, gdb_byte **start, size_t *length) { internal_error (__FILE__, __LINE__, _("Support for DW_OP_fbreg is unimplemented")); @@ -238,7 +238,7 @@ no_get_tls_address (void *baton, CORE_ADDR offset) } static CORE_ADDR -execute_stack_op (unsigned char *exp, ULONGEST len, +execute_stack_op (gdb_byte *exp, ULONGEST len, struct frame_info *next_frame, CORE_ADDR initial) { struct dwarf_expr_context *ctx; @@ -265,7 +265,7 @@ execute_stack_op (unsigned char *exp, ULONGEST len, static void -execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, +execute_cfa_program (gdb_byte *insn_ptr, gdb_byte *insn_end, struct frame_info *next_frame, struct dwarf2_frame_state *fs) { @@ -274,7 +274,7 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end, while (insn_ptr < insn_end && fs->pc <= pc) { - unsigned char insn = *insn_ptr++; + gdb_byte insn = *insn_ptr++; ULONGEST utmp, reg; LONGEST offset; @@ -399,7 +399,8 @@ bad CFI data; mismatched DW_CFA_restore_state at 0x%s"), paddr (fs->pc)); break; case DW_CFA_def_cfa_offset: - insn_ptr = read_uleb128 (insn_ptr, insn_end, &fs->cfa_offset); + insn_ptr = read_uleb128 (insn_ptr, insn_end, &utmp); + fs->cfa_offset = utmp; /* cfa_how deliberately not set. */ break; @@ -1020,7 +1021,7 @@ struct comp_unit struct dwarf2_cie *cie; /* Pointer to the .debug_frame section loaded into memory. */ - char *dwarf_frame_buffer; + gdb_byte *dwarf_frame_buffer; /* Length of the loaded .debug_frame section. */ unsigned long dwarf_frame_size; @@ -1038,30 +1039,30 @@ struct comp_unit const struct objfile_data *dwarf2_frame_objfile_data; static unsigned int -read_1_byte (bfd *bfd, char *buf) +read_1_byte (bfd *abfd, gdb_byte *buf) { - return bfd_get_8 (abfd, (bfd_byte *) buf); + return bfd_get_8 (abfd, buf); } static unsigned int -read_4_bytes (bfd *abfd, char *buf) +read_4_bytes (bfd *abfd, gdb_byte *buf) { - return bfd_get_32 (abfd, (bfd_byte *) buf); + return bfd_get_32 (abfd, buf); } static ULONGEST -read_8_bytes (bfd *abfd, char *buf) +read_8_bytes (bfd *abfd, gdb_byte *buf) { - return bfd_get_64 (abfd, (bfd_byte *) buf); + return bfd_get_64 (abfd, buf); } static ULONGEST -read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) +read_unsigned_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr) { ULONGEST result; unsigned int num_read; int shift; - unsigned char byte; + gdb_byte byte; result = 0; shift = 0; @@ -1083,12 +1084,12 @@ read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) } static LONGEST -read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) +read_signed_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr) { LONGEST result; int shift; unsigned int num_read; - unsigned char byte; + gdb_byte byte; result = 0; shift = 0; @@ -1113,14 +1114,14 @@ read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) } static ULONGEST -read_initial_length (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) +read_initial_length (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr) { LONGEST result; - result = bfd_get_32 (abfd, (bfd_byte *) buf); + result = bfd_get_32 (abfd, buf); if (result == 0xffffffff) { - result = bfd_get_64 (abfd, (bfd_byte *) buf + 4); + result = bfd_get_64 (abfd, buf + 4); *bytes_read_ptr = 12; } else @@ -1146,7 +1147,7 @@ read_initial_length (bfd *abfd, char *buf, unsigned int *bytes_read_ptr) position in the FDE, ...). Bit 7, indicates that the address should be dereferenced. */ -static unsigned char +static gdb_byte encoding_for_size (unsigned int size) { switch (size) @@ -1163,7 +1164,7 @@ encoding_for_size (unsigned int size) } static unsigned int -size_of_encoded_value (unsigned char encoding) +size_of_encoded_value (gdb_byte encoding) { if (encoding == DW_EH_PE_omit) return 0; @@ -1184,8 +1185,8 @@ size_of_encoded_value (unsigned char encoding) } static CORE_ADDR -read_encoded_value (struct comp_unit *unit, unsigned char encoding, - unsigned char *buf, unsigned int *bytes_read_ptr) +read_encoded_value (struct comp_unit *unit, gdb_byte encoding, + gdb_byte *buf, unsigned int *bytes_read_ptr) { int ptr_len = size_of_encoded_value (DW_EH_PE_absptr); ptrdiff_t offset; @@ -1206,7 +1207,7 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, break; case DW_EH_PE_pcrel: base = bfd_get_section_vma (unit->bfd, unit->dwarf_frame_section); - base += ((char *) buf - unit->dwarf_frame_buffer); + base += (buf - unit->dwarf_frame_buffer); break; case DW_EH_PE_datarel: base = unit->dbase; @@ -1224,7 +1225,7 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, break; case DW_EH_PE_aligned: base = 0; - offset = (char *) buf - unit->dwarf_frame_buffer; + offset = buf - unit->dwarf_frame_buffer; if ((offset % ptr_len) != 0) { *bytes_read_ptr = ptr_len - (offset % ptr_len); @@ -1243,7 +1244,7 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, case DW_EH_PE_uleb128: { ULONGEST value; - unsigned char *end_buf = buf + (sizeof (value) + 1) * 8 / 7; + gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7; *bytes_read_ptr += read_uleb128 (buf, end_buf, &value) - buf; return base + value; } @@ -1259,7 +1260,7 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, case DW_EH_PE_sleb128: { LONGEST value; - char *end_buf = buf + (sizeof (value) + 1) * 8 / 7; + gdb_byte *end_buf = buf + (sizeof (value) + 1) * 8 / 7; *bytes_read_ptr += read_sleb128 (buf, end_buf, &value) - buf; return base + value; } @@ -1353,21 +1354,20 @@ add_fde (struct comp_unit *unit, struct dwarf2_fde *fde) #define DW64_CIE_ID ~0 #endif -static char *decode_frame_entry (struct comp_unit *unit, char *start, - int eh_frame_p); +static gdb_byte *decode_frame_entry (struct comp_unit *unit, gdb_byte *start, + int eh_frame_p); /* Decode the next CIE or FDE. Return NULL if invalid input, otherwise the next byte to be processed. */ -static char * -decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p) +static gdb_byte * +decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p) { - char *buf; + gdb_byte *buf, *end; LONGEST length; unsigned int bytes_read; int dwarf64_p; ULONGEST cie_id; ULONGEST cie_pointer; - char *end; buf = start; length = read_initial_length (unit->abfd, buf, &bytes_read); @@ -1434,8 +1434,8 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p) buf += 1; /* Interpret the interesting bits of the augmentation. */ - augmentation = buf; - buf = augmentation + strlen (augmentation) + 1; + augmentation = (char *) buf; + buf += (strlen (augmentation) + 1); /* The GCC 2.x "eh" augmentation has a pointer immediately following the augmentation string, so it must be handled @@ -1499,7 +1499,7 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p) else if (*augmentation == 'P') { /* Skip. Avoid indirection since we throw away the result. */ - unsigned char encoding = (*buf++) & ~DW_EH_PE_indirect; + gdb_byte encoding = (*buf++) & ~DW_EH_PE_indirect; read_encoded_value (unit, encoding, buf, &bytes_read); buf += bytes_read; augmentation++; @@ -1587,11 +1587,11 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p) } /* Read a CIE or FDE in BUF and decode it. */ -static char * -decode_frame_entry (struct comp_unit *unit, char *start, int eh_frame_p) +static gdb_byte * +decode_frame_entry (struct comp_unit *unit, gdb_byte *start, int eh_frame_p) { enum { NONE, ALIGN4, ALIGN8, FAIL } workaround = NONE; - char *ret; + gdb_byte *ret; const char *msg; ptrdiff_t start_offset; @@ -1693,7 +1693,7 @@ void dwarf2_build_frame_info (struct objfile *objfile) { struct comp_unit unit; - char *frame_ptr; + gdb_byte *frame_ptr; /* Build a minimal decoding of the DWARF2 compilation unit. */ unit.abfd = objfile->obfd; diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 0d318e4..e75dcee 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -1,5 +1,7 @@ -/* Dwarf2 Expression Evaluator - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. +/* DWARF 2 Expression Evaluator. + + Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + Contributed by Daniel Berlin (dan@dberlin.org) This file is part of GDB. @@ -30,7 +32,7 @@ /* Local prototypes. */ static void execute_stack_op (struct dwarf_expr_context *, - unsigned char *, unsigned char *); + gdb_byte *, gdb_byte *); /* Create a new context for the expression evaluator. */ @@ -130,8 +132,7 @@ add_piece (struct dwarf_expr_context *ctx, CTX. */ void -dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr, - size_t len) +dwarf_expr_eval (struct dwarf_expr_context *ctx, gdb_byte *addr, size_t len) { execute_stack_op (ctx, addr, addr + len); } @@ -140,12 +141,12 @@ dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr, by R, and return the new value of BUF. Verify that it doesn't extend past BUF_END. */ -unsigned char * -read_uleb128 (unsigned char *buf, unsigned char *buf_end, ULONGEST * r) +gdb_byte * +read_uleb128 (gdb_byte *buf, gdb_byte *buf_end, ULONGEST * r) { unsigned shift = 0; ULONGEST result = 0; - unsigned char byte; + gdb_byte byte; while (1) { @@ -166,12 +167,12 @@ read_uleb128 (unsigned char *buf, unsigned char *buf_end, ULONGEST * r) by R, and return the new value of BUF. Verify that it doesn't extend past BUF_END. */ -unsigned char * -read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r) +gdb_byte * +read_sleb128 (gdb_byte *buf, gdb_byte *buf_end, LONGEST * r) { unsigned shift = 0; LONGEST result = 0; - unsigned char byte; + gdb_byte byte; while (1) { @@ -196,7 +197,7 @@ read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r) number of bytes read from BUF. */ CORE_ADDR -dwarf2_read_address (unsigned char *buf, unsigned char *buf_end, int *bytes_read) +dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read) { CORE_ADDR result; @@ -252,8 +253,8 @@ signed_address_type (void) evaluate the expression between OP_PTR and OP_END. */ static void -execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, - unsigned char *op_end) +execute_stack_op (struct dwarf_expr_context *ctx, + gdb_byte *op_ptr, gdb_byte *op_end) { ctx->in_reg = 0; @@ -449,7 +450,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, break; case DW_OP_fbreg: { - unsigned char *datastart; + gdb_byte *datastart; size_t datalen; unsigned int before_stack_len; @@ -519,7 +520,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, { case DW_OP_deref: { - char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT); + gdb_byte *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT); int bytes_read; (ctx->read_mem) (ctx->baton, buf, result, @@ -533,7 +534,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, case DW_OP_deref_size: { - char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT); + gdb_byte *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT); int bytes_read; (ctx->read_mem) (ctx->baton, buf, result, *op_ptr++); diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h index f22d085..cdfc264 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -1,6 +1,9 @@ -/* Dwarf2 Expression Evaluator - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin (dan@dberlin.org) +/* DWARF 2 Expression Evaluator. + + Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + + Contributed by Daniel Berlin <dan@dberlin.org>. + This file is part of GDB. This program is free software; you can redistribute it and/or modify @@ -40,14 +43,12 @@ struct dwarf_expr_context CORE_ADDR (*read_reg) (void *baton, int regnum); /* Read LENGTH bytes at ADDR into BUF. */ - void (*read_mem) (void *baton, char *buf, CORE_ADDR addr, - size_t length); + void (*read_mem) (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t length); /* Return the location expression for the frame base attribute, in START and LENGTH. The result must be live until the current expression evaluation is complete. */ - void (*get_frame_base) (void *baton, unsigned char **start, - size_t *length); + void (*get_frame_base) (void *baton, gdb_byte **start, size_t *length); /* Return the thread-local storage address for DW_OP_GNU_push_tls_address. */ @@ -129,11 +130,9 @@ void dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr, CORE_ADDR dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n); -unsigned char *read_uleb128 (unsigned char *buf, unsigned char *buf_end, - ULONGEST * r); -unsigned char *read_sleb128 (unsigned char *buf, unsigned char *buf_end, - LONGEST * r); -CORE_ADDR dwarf2_read_address (unsigned char *buf, unsigned char *buf_end, +gdb_byte *read_uleb128 (gdb_byte *buf, gdb_byte *buf_end, ULONGEST * r); +gdb_byte *read_sleb128 (gdb_byte *buf, gdb_byte *buf_end, LONGEST * r); +CORE_ADDR dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read); -#endif +#endif /* dwarf2expr.h */ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 47c8101..6c33448 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -52,13 +52,14 @@ For now, only return the first matching location expression; there can be more than one in the list. */ -static char * +static gdb_byte * find_location_expression (struct dwarf2_loclist_baton *baton, size_t *locexpr_length, CORE_ADDR pc) { CORE_ADDR low, high; - char *loc_ptr, *buf_end; - unsigned int addr_size = TARGET_ADDR_BIT / TARGET_CHAR_BIT, length; + gdb_byte *loc_ptr, *buf_end; + int length; + unsigned int addr_size = TARGET_ADDR_BIT / TARGET_CHAR_BIT; CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1)); /* Adjust base_address for relocatable objects. */ CORE_ADDR base_offset = ANOFFSET (baton->objfile->section_offsets, @@ -122,12 +123,12 @@ dwarf_expr_read_reg (void *baton, int dwarf_regnum) struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; CORE_ADDR result, save_addr; enum lval_type lval_type; - char *buf; + gdb_byte *buf; int optimized, regnum, realnum, regsize; regnum = DWARF2_REG_TO_REGNUM (dwarf_regnum); regsize = register_size (current_gdbarch, regnum); - buf = (char *) alloca (regsize); + buf = alloca (regsize); frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr, &realnum, buf); @@ -141,7 +142,7 @@ dwarf_expr_read_reg (void *baton, int dwarf_regnum) /* Read memory at ADDR (length LEN) into BUF. */ static void -dwarf_expr_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len) +dwarf_expr_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len) { read_memory (addr, buf, len); } @@ -150,7 +151,7 @@ dwarf_expr_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len) describing the frame base. Return a pointer to it in START and its length in LENGTH. */ static void -dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length) +dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length) { /* FIXME: cagney/2003-03-26: This code should be using get_frame_base_address(), and then implement a dwarf2 specific @@ -273,7 +274,7 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) of FRAME. */ static struct value * dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, - unsigned char *data, unsigned short size, + gdb_byte *data, unsigned short size, struct objfile *objfile) { struct gdbarch *arch = get_frame_arch (frame); @@ -350,16 +351,16 @@ needs_frame_read_reg (void *baton, int regnum) /* Reads from memory do not require a frame. */ static void -needs_frame_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len) +needs_frame_read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len) { memset (buf, 0, len); } /* Frame-relative accesses do require a frame. */ static void -needs_frame_frame_base (void *baton, unsigned char **start, size_t * length) +needs_frame_frame_base (void *baton, gdb_byte **start, size_t * length) { - static char lit0 = DW_OP_lit0; + static gdb_byte lit0 = DW_OP_lit0; struct needs_frame_baton *nf_baton = baton; *start = &lit0; @@ -381,7 +382,7 @@ needs_frame_tls_address (void *baton, CORE_ADDR offset) requires a frame to evaluate. */ static int -dwarf2_loc_desc_needs_frame (unsigned char *data, unsigned short size) +dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size) { struct needs_frame_baton baton; struct dwarf_expr_context *ctx; @@ -417,8 +418,8 @@ dwarf2_loc_desc_needs_frame (unsigned char *data, unsigned short size) } static void -dwarf2_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, - struct axs_value * value, unsigned char *data, +dwarf2_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax, + struct axs_value *value, gdb_byte *data, int size) { if (size == 0) @@ -445,7 +446,7 @@ dwarf2_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, as above. */ int frame_reg; LONGEST frame_offset; - unsigned char *buf_end; + gdb_byte *buf_end; buf_end = read_sleb128 (data + 1, data + size, &frame_offset); if (buf_end != data + size) @@ -575,7 +576,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame) { struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); struct value *val; - unsigned char *data; + gdb_byte *data; size_t size; data = find_location_expression (dlbaton, &size, @@ -622,7 +623,7 @@ loclist_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax, struct axs_value * value) { struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); - unsigned char *data; + gdb_byte *data; size_t size; data = find_location_expression (dlbaton, &size, ax->scope); diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index ce0a8ef..ee2eeb0 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -1,5 +1,6 @@ -/* Dwarf2 location expression support for GDB. - Copyright 2003 Free Software Foundation, Inc. +/* DWARF 2 location expression support for GDB. + + Copyright 2003, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -35,7 +36,7 @@ struct symbol_ops; struct dwarf2_locexpr_baton { /* Pointer to the start of the location expression. */ - unsigned char *data; + gdb_byte *data; /* Length of the location expression. */ unsigned short size; @@ -51,7 +52,7 @@ struct dwarf2_loclist_baton CORE_ADDR base_address; /* Pointer to the start of the location list. */ - unsigned char *data; + gdb_byte *data; /* Length of the location list. */ unsigned short size; @@ -67,4 +68,4 @@ struct dwarf2_loclist_baton extern const struct symbol_ops dwarf2_locexpr_funcs; extern const struct symbol_ops dwarf2_loclist_funcs; -#endif +#endif /* dwarf2loc.h */ |