From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32362 invoked by alias); 29 Oct 2003 22:03:51 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32355 invoked from network); 29 Oct 2003 22:03:49 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 29 Oct 2003 22:03:49 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id B0AF02B89; Wed, 29 Oct 2003 17:03:47 -0500 (EST) Message-ID: <3FA03943.6090805@redhat.com> Date: Wed, 29 Oct 2003 22:03:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [patch, rfa:ppc64, rfa:breakpoint] Add non-verbose breakpoint adjustment References: <3F9D5864.50807@redhat.com> <1031028205935.ZM3486@localhost.localdomain> <3F9DAC5F.8030007@redhat.com> <1031029032725.ZM4659@localhost.localdomain> <3F9E9469.4050401@redhat.com> <1031029163018.ZM6880@localhost.localdomain> Content-Type: multipart/mixed; boundary="------------020308070609020304070401" X-SW-Source: 2003-10/txt/msg00846.txt.bz2 This is a multi-part message in MIME format. --------------020308070609020304070401 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1187 > On Oct 28, 11:08am, Andrew Cagney wrote: > > >> > As a user, it annoyed me :-) > >> >> >> >> If you'd prefer I'll let PPC64 print both warnings as well. > >> > >> > ppc and frv are very different. > >> >> I'm not so sure. Here's the interaction: >> >> (gdb) print &main >> $1 = ( *) 0x104e5a60 >> (gdb) break main >> Breakpoint 2 at 0x100895d0 >> (gdb) run >> Starting program: >> /home/cagney/PENDING/YYYY-MM-DD-target-convert-func/64/gdb/stripped.gdb >> ... >> Breakpoint 2, 0x00000000100895d0 in .main () >> (gdb) >> >> (I've yet to figure out why GDB keeps reporting those breakpoints). Oops, lost the message. GDB sometimes prints: Breakpoint 2 at 0x100895d0 which, I think is from GDB doing a "if breakpoint.one_addr != breakpoint.second_addr then print message" comparison everytime a shared library breakpoint is hit. >> Notice how "main" is in the data space yet GDB set a code space >> breakpoint (and even stopped on a different symbol). Might as well >> notify the user of this adjustment. > > > Okay, I see your point. This is surprising enough to merit a warning. Attached is a much simplified patch. Ok? Andrew --------------020308070609020304070401 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 4871 2003-10-29 Andrew Cagney * rs6000-tdep.c (rs6000_gdbarch_init): For 64-bit ABI, set adjust_breakpoint_address. * Makefile.in (ppc-sysv-tdep.o): Add $(target_h). * ppc-tdep.h (ppc64_sysv_abi_adjust_breakpoint_address): Declare. * ppc-sysv-tdep.c: Include "target.h". Update copyright. (ppc64_sysv_abi_adjust_breakpoint_address): New function. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.463 diff -u -r1.463 Makefile.in --- Makefile.in 24 Oct 2003 20:24:05 -0000 1.463 +++ Makefile.in 29 Oct 2003 22:00:30 -0000 @@ -2126,7 +2126,8 @@ $(target_h) $(breakpoint_h) $(value_h) $(osabi_h) $(ppc_tdep_h) \ $(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(solib_svr4_h) ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ - $(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) $(ppc_tdep_h) + $(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \ + $(ppc_tdep_h) $(target_h) printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \ $(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \ $(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \ Index: ppc-sysv-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ppc-sysv-tdep.c,v retrieving revision 1.17 diff -u -r1.17 ppc-sysv-tdep.c --- ppc-sysv-tdep.c 20 Oct 2003 15:38:02 -0000 1.17 +++ ppc-sysv-tdep.c 29 Oct 2003 22:00:31 -0000 @@ -1,7 +1,7 @@ /* Target-dependent code for PowerPC systems using the SVR4 ABI for GDB, the GNU debugger. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -28,6 +28,7 @@ #include "gdb_string.h" #include "gdb_assert.h" #include "ppc-tdep.h" +#include "target.h" /* Pass the arguments in either registers, or in the stack. Using the ppc sysv ABI, the first eight words of the argument list (that might @@ -1012,4 +1013,22 @@ { if (!ppc64_sysv_abi_return_value (valtype, regbuf, valbuf, NULL)) error ("Function return value location unknown"); +} + +CORE_ADDR +ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch, + CORE_ADDR bpaddr) +{ + /* PPC64 SYSV specifies that the minimal-symbol "FN" should point at + a function-descriptor while the corresponding minimal-symbol + ".FN" should point at the entry point. Consequently, a command + like "break FN" applied to an object file with only minimal + symbols, will insert the breakpoint into the descriptor at "FN" + and not the function at ".FN". Avoid this confusion by adjusting + any attempt to set a descriptor breakpoint into a corresponding + function breakpoint. Note that GDB warns the user when this + adjustment is applied - that's ok as otherwise the user will have + no way of knowing why their breakpoint at "FN" resulted in the + program stopping at ".FN". */ + return gdbarch_convert_from_func_ptr_addr (gdbarch, bpaddr, ¤t_target); } Index: ppc-tdep.h =================================================================== RCS file: /cvs/src/src/gdb/ppc-tdep.h,v retrieving revision 1.22 diff -u -r1.22 ppc-tdep.h --- ppc-tdep.h 10 Oct 2003 21:32:47 -0000 1.22 +++ ppc-tdep.h 29 Oct 2003 22:00:31 -0000 @@ -61,6 +61,8 @@ struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch, + CORE_ADDR bpaddr); int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache); struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void); void ppc_linux_supply_gregset (char *buf); Index: rs6000-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v retrieving revision 1.170 diff -u -r1.170 rs6000-tdep.c --- rs6000-tdep.c 22 Oct 2003 23:54:11 -0000 1.170 +++ rs6000-tdep.c 29 Oct 2003 22:00:31 -0000 @@ -2895,6 +2895,15 @@ set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, rs6000_breakpoint_from_pc); + /* Handle the 64-bit SVR4 minimal-symbol convention of using "FN" + for the descriptor and ".FN" for the entry-point -- a user + specifying "break FN" will unexpectedly end up with a breakpoint + on the descriptor and not the function. This architecture method + transforms any breakpoints on descriptors into breakpoints on the + corresponding entry point. */ + if (sysv_abi && wordsize == 8) + set_gdbarch_adjust_breakpoint_address (gdbarch, ppc64_sysv_abi_adjust_breakpoint_address); + /* Not sure on this. FIXMEmgo */ set_gdbarch_frame_args_skip (gdbarch, 8); --------------020308070609020304070401--