From 85ddcc7021c2709e1b2846277d9af37fe0c6ee80 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 21 Nov 2012 00:29:55 +0000 Subject: [PATCH] gdb/ 2012-11-21 Yao Qi PR tdep/7438 * gdbarch.sh (smash_text_address): Remove. * gdbarch.c, gdbarch.h: Regenerate. * arm-tdep.c (arm_smash_text_address): Remove. (arm_gdbarch_init): Don't call set_gdbarch_smash_text_address. * hppa-tdep.c (hppa_smash_text_address): Remove. (hppa_addr_bits_remove): Rename from hppa_smash_text_address. (hppa_gdbarch_init): Don't call set_gdbarch_smash_text_address. Caller update. * coffread.c (coff_symtab_read): Caller update. * dbxread.c (process_one_symbol): Likewise. * elfread.c (record_minimal_symbol): Likewise. * somread.c (som_symtab_read): Likewise. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/arm-tdep.c | 9 --------- gdb/coffread.c | 2 +- gdb/dbxread.c | 2 +- gdb/elfread.c | 2 +- gdb/gdbarch.c | 24 ------------------------ gdb/gdbarch.h | 7 ------- gdb/gdbarch.sh | 3 --- gdb/hppa-tdep.c | 5 ++--- gdb/somread.c | 14 +++++++------- 10 files changed, 28 insertions(+), 56 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0806e67a42e..7f0d3e2c949 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2012-11-21 Yao Qi + + PR tdep/7438 + * gdbarch.sh (smash_text_address): Remove. + * gdbarch.c, gdbarch.h: Regenerate. + * arm-tdep.c (arm_smash_text_address): Remove. + (arm_gdbarch_init): Don't call set_gdbarch_smash_text_address. + * hppa-tdep.c (hppa_smash_text_address): Remove. + (hppa_addr_bits_remove): Rename from hppa_smash_text_address. + (hppa_gdbarch_init): Don't call set_gdbarch_smash_text_address. + Caller update. + * coffread.c (coff_symtab_read): Caller update. + * dbxread.c (process_one_symbol): Likewise. + * elfread.c (record_minimal_symbol): Likewise. + * somread.c (som_symtab_read): Likewise. + 2012-11-20 Pierre Muller ARI fixes: sprintf rule. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 8e969462bae..7f3155b35dc 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -460,14 +460,6 @@ arm_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val) return (val & 0x03fffffc); } -/* When reading symbols, we need to zap the low bit of the address, - which may be set to 1 for Thumb functions. */ -static CORE_ADDR -arm_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR val) -{ - return val & ~1; -} - /* Return 1 if PC is the start of a compiler helper function which can be safely ignored during prologue skipping. IS_THUMB is true if the function is known to be a Thumb function due to the way it @@ -10283,7 +10275,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_base_set_default (gdbarch, &arm_normal_base); /* Address manipulation. */ - set_gdbarch_smash_text_address (gdbarch, arm_smash_text_address); set_gdbarch_addr_bits_remove (gdbarch, arm_addr_bits_remove); /* Advance PC across function entry code. */ diff --git a/gdb/coffread.c b/gdb/coffread.c index 0c7e6d90abe..37899953e90 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -941,7 +941,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC || cs->c_sclass == C_THUMBEXT ? mst_text : mst_file_text; - tmpaddr = gdbarch_smash_text_address (gdbarch, tmpaddr); + tmpaddr = gdbarch_addr_bits_remove (gdbarch, tmpaddr); } else if (bfd_section->flags & SEC_ALLOC && bfd_section->flags & SEC_LOAD) diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 2d47407da31..9d0e62404c8 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2827,7 +2827,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, /* Relocate for dynamic loading. */ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - valu = gdbarch_smash_text_address (gdbarch, valu); + valu = gdbarch_addr_bits_remove (gdbarch, valu); last_function_start = valu; goto define_a_symbol; diff --git a/gdb/elfread.c b/gdb/elfread.c index 516cbd0e3a4..84efc594dcf 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -205,7 +205,7 @@ record_minimal_symbol (const char *name, int name_len, int copy_name, if (ms_type == mst_text || ms_type == mst_file_text || ms_type == mst_text_gnu_ifunc) - address = gdbarch_smash_text_address (gdbarch, address); + address = gdbarch_addr_bits_remove (gdbarch, address); return prim_record_minimal_symbol_full (name, name_len, copy_name, address, ms_type, bfd_section->index, diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 09576b138dc..6ae453ec53d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -220,7 +220,6 @@ struct gdbarch int frame_red_zone_size; gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr; gdbarch_addr_bits_remove_ftype *addr_bits_remove; - gdbarch_smash_text_address_ftype *smash_text_address; gdbarch_software_single_step_ftype *software_single_step; gdbarch_single_step_through_delay_ftype *single_step_through_delay; gdbarch_print_insn_ftype *print_insn; @@ -389,7 +388,6 @@ struct gdbarch startup_gdbarch = 0, /* frame_red_zone_size */ convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */ core_addr_identity, /* addr_bits_remove */ - core_addr_identity, /* smash_text_address */ 0, /* software_single_step */ 0, /* single_step_through_delay */ 0, /* print_insn */ @@ -526,7 +524,6 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr; gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity; gdbarch->addr_bits_remove = core_addr_identity; - gdbarch->smash_text_address = core_addr_identity; gdbarch->skip_trampoline_code = generic_skip_trampoline_code; gdbarch->skip_solib_resolver = generic_skip_solib_resolver; gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; @@ -689,7 +686,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */ /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ /* Skip verify of addr_bits_remove, invalid_p == 0 */ - /* Skip verify of smash_text_address, invalid_p == 0 */ /* Skip verify of software_single_step, has predicate. */ /* Skip verify of single_step_through_delay, has predicate. */ if (gdbarch->print_insn == 0) @@ -1285,9 +1281,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: skip_trampoline_code = <%s>\n", host_address_to_string (gdbarch->skip_trampoline_code)); - fprintf_unfiltered (file, - "gdbarch_dump: smash_text_address = <%s>\n", - host_address_to_string (gdbarch->smash_text_address)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_software_single_step_p() = %d\n", gdbarch_software_single_step_p (gdbarch)); @@ -2981,23 +2974,6 @@ set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch->addr_bits_remove = addr_bits_remove; } -CORE_ADDR -gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->smash_text_address != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n"); - return gdbarch->smash_text_address (gdbarch, addr); -} - -void -set_gdbarch_smash_text_address (struct gdbarch *gdbarch, - gdbarch_smash_text_address_ftype smash_text_address) -{ - gdbarch->smash_text_address = smash_text_address; -} - int gdbarch_software_single_step_p (struct gdbarch *gdbarch) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index df095532bc4..3d9dc79ee37 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -600,13 +600,6 @@ typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (struct gdbarch *gdbarch, COR extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr); extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove); -/* It is not at all clear why gdbarch_smash_text_address is not folded into - gdbarch_addr_bits_remove. */ - -typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); -extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr); -extern void set_gdbarch_smash_text_address (struct gdbarch *gdbarch, gdbarch_smash_text_address_ftype *smash_text_address); - /* FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if the target needs software single step. An ISA method to implement it. diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 4b11f92d9a2..81a70b0e341 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -574,9 +574,6 @@ m:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:a # sort of generic thing to handle alignment or segmentation (it's # possible it should be in TARGET_READ_PC instead). m:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0 -# It is not at all clear why gdbarch_smash_text_address is not folded into -# gdbarch_addr_bits_remove. -m:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0 # FIXME/cagney/2001-01-18: This should be split in two. A target method that # indicates if the target needs software single step. An ISA method to diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 581ffc7aad8..5ee758e42db 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2640,7 +2640,7 @@ hppa64_cannot_fetch_register (struct gdbarch *gdbarch, int regnum) } static CORE_ADDR -hppa_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr) +hppa_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) { /* The low two bits of the PC on the PA contain the privilege level. Some genius implementing a (non-GCC) compiler apparently decided @@ -3058,8 +3058,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_greaterthan); set_gdbarch_sp_regnum (gdbarch, HPPA_SP_REGNUM); set_gdbarch_fp0_regnum (gdbarch, HPPA_FP0_REGNUM); - set_gdbarch_addr_bits_remove (gdbarch, hppa_smash_text_address); - set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address); + set_gdbarch_addr_bits_remove (gdbarch, hppa_addr_bits_remove); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_read_pc (gdbarch, hppa_read_pc); set_gdbarch_write_pc (gdbarch, hppa_write_pc); diff --git a/gdb/somread.c b/gdb/somread.c index 19a15e21983..aeeb9928ee2 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -121,7 +121,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, symname = bufp->name.n_strx + stringtab; ms_type = mst_text; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); break; @@ -135,7 +135,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, else ms_type = mst_text; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); break; @@ -143,7 +143,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, symname = bufp->name.n_strx + stringtab; ms_type = mst_solib_trampoline; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); break; @@ -172,7 +172,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, symname = bufp->name.n_strx + stringtab; ms_type = mst_file_text; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); check_strange_names: @@ -204,7 +204,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, symname = bufp->name.n_strx + stringtab; ms_type = mst_file_text; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); break; @@ -216,7 +216,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, we do for SS_UNIVERSAL and SS_EXTERNAL symbols above. */ ms_type = mst_file_text; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); break; @@ -224,7 +224,7 @@ som_symtab_read (bfd *abfd, struct objfile *objfile, symname = bufp->name.n_strx + stringtab; ms_type = mst_solib_trampoline; bufp->symbol_value += text_offset; - bufp->symbol_value = gdbarch_smash_text_address + bufp->symbol_value = gdbarch_addr_bits_remove (gdbarch, bufp->symbol_value); break; -- 2.30.2