From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Snyder To: gdb-patches@sources.redhat.com Subject: [PATCH] pseudo-register un-optimization Date: Fri, 10 Aug 2001 14:54:00 -0000 Message-id: <3B7456F6.5596AE84@cygnus.com> X-SW-Source: 2001-08/msg00114.html 2001-08-10 Michael Snyder * regcache.c (legacy_write_register_gen): Don't 'optimize out' a write_register to a pseudo-reg. Target_store_pseudo_register needs to get called, because these regs may be computed and may have side-effects. Index: regcache.c =================================================================== RCS file: /cvs/src/src/gdb/regcache.c,v retrieving revision 1.24 diff -c -3 -p -r1.24 regcache.c *** regcache.c 2001/06/15 23:50:46 1.24 --- regcache.c 2001/08/10 21:49:23 *************** legacy_write_register_gen (int regnum, c *** 334,348 **** size = REGISTER_RAW_SIZE (regnum); - /* If we have a valid copy of the register, and new value == old value, - then don't bother doing the actual store. */ - - if (register_cached (regnum) - && memcmp (register_buffer (regnum), myaddr, size) == 0) - return; - if (real_register (regnum)) ! target_prepare_to_store (); memcpy (register_buffer (regnum), myaddr, size); --- 334,349 ---- size = REGISTER_RAW_SIZE (regnum); if (real_register (regnum)) ! { ! /* If we have a valid copy of the register, and new value == old ! value, then don't bother doing the actual store. */ ! if (register_cached (regnum) ! && memcmp (register_buffer (regnum), myaddr, size) == 0) ! return; ! else ! target_prepare_to_store (); ! } memcpy (register_buffer (regnum), myaddr, size); >From hjl@lucon.org Fri Aug 10 15:31:00 2001 From: "H . J . Lu" To: gdb@sources.redhat.com, gdb-patches@sources.redhat.com Subject: Re: [rfa] Re: The problem with stabs and sign extension Date: Fri, 10 Aug 2001 15:31:00 -0000 Message-id: <20010810153149.A15186@lucon.org> References: <20010808141207.A31287@nevyn.them.org> <20010808161421.A3360@lucon.org> <20010808165359.A3964@lucon.org> <20010808170326.A4132@lucon.org> <20010808171616.A7610@nevyn.them.org> X-SW-Source: 2001-08/msg00115.html Content-length: 2370 On Wed, Aug 08, 2001 at 05:16:16PM -0700, Daniel Jacobowitz wrote: > > There's actually a clear bug here, once you know where to look. A > CORE_ADDR is assigned to a long int in partial-stab.h. There's a > warning flag in GCC for this, isn't there? > You miised one CORE_ADDR in partial-stab.h. This patch seems to fix my problem. Any comments? Thanks. H.J. ----- 2001-08-10 Daniel Jacobowitz H.J. Lu (hjl@gnu.org) * partial-stab.h: valu should be a CORE_ADDR. 2001-08-08 H.J. Lu (hjl@gnu.org) * dbxread.c (SWAP_SYMBOL): Removed. (INTERNALIZE_SYMBOL): Check sign extended vma. --- gdb/dbxread.c.vma Fri Jul 13 12:12:34 2001 +++ gdb/dbxread.c Wed Aug 8 21:02:29 2001 @@ -946,22 +946,15 @@ fill_symbuf (bfd *sym_bfd) symbuf_read += nbytes; } -#define SWAP_SYMBOL(symp, abfd) \ - { \ - (symp)->n_strx = bfd_h_get_32(abfd, \ - (unsigned char *)&(symp)->n_strx); \ - (symp)->n_desc = bfd_h_get_16 (abfd, \ - (unsigned char *)&(symp)->n_desc); \ - (symp)->n_value = bfd_h_get_32 (abfd, \ - (unsigned char *)&(symp)->n_value); \ - } - #define INTERNALIZE_SYMBOL(intern, extern, abfd) \ { \ (intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type); \ (intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx); \ (intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc); \ - (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \ + if (bfd_get_sign_extend_vma (abfd)) \ + (intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value); \ + else \ + (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \ } /* Invariant: The symbol pointed to by symbuf_idx is the first one --- gdb/partial-stab.h.vma Fri Jul 13 12:12:54 2001 +++ gdb/partial-stab.h Fri Aug 10 15:25:10 2001 @@ -201,7 +201,7 @@ switch (CUR_SYMBOL_TYPE) case N_SO: { - unsigned long valu; + CORE_ADDR valu; static int prev_so_symnum = -10; static int first_so_symnum; char *p; @@ -399,7 +399,7 @@ switch (CUR_SYMBOL_TYPE) /* See if this is an end of function stab. */ if (pst && CUR_SYMBOL_TYPE == N_FUN && *namestring == '\000') { - unsigned long valu; + CORE_ADDR valu; /* It's value is the size (in bytes) of the function for function relative stabs, or the address of the function's