public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Switch shared library default backend to solib-target.c
@ 2010-06-15 17:59 Pedro Alves
  2010-06-15 18:05 ` Pedro Alves
  2010-06-15 20:37 ` Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: Pedro Alves @ 2010-06-15 17:59 UTC (permalink / raw)
  To: gdb-patches

This patch changes GDB to default to enabling target
reported shared libraries.  I've applied it.

It does that by using solib-target.c by default, instead of
solib-null.c.  The patch actually gets rid of solib-null.c entirely.
This means that for example, a generic elf gdb build (e.g., arm-eabi, without a
default OSABI), can be used to debug random RTOSs that report loaded
shared libraries using the "qXfer:libraries:read" remote protocol
packet.

Since solib-target.c behaves exactly the same as solib-null.c
when the target doesn't implement the TARGET_OBJECT_LIBRARIES
xfer, this is always either a win, or a nop.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Switch shared library default backend to solib-target.c
  2010-06-15 17:59 Switch shared library default backend to solib-target.c Pedro Alves
@ 2010-06-15 18:05 ` Pedro Alves
  2010-06-15 20:37 ` Pedro Alves
  1 sibling, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2010-06-15 18:05 UTC (permalink / raw)
  To: gdb-patches

On Tuesday 15 June 2010 18:58:57, Pedro Alves wrote:
> This patch changes GDB to default to enabling target
> reported shared libraries.  I've applied it.
> 
> It does that by using solib-target.c by default, instead of
> solib-null.c.  The patch actually gets rid of solib-null.c entirely.
> This means that for example, a generic elf gdb build (e.g., arm-eabi, without a
> default OSABI), can be used to debug random RTOSs that report loaded
> shared libraries using the "qXfer:libraries:read" remote protocol
> packet.
> 
> Since solib-target.c behaves exactly the same as solib-null.c
> when the target doesn't implement the TARGET_OBJECT_LIBRARIES
> xfer, this is always either a win, or a nop.
> 
> 

ENOPATCH.  Here it is.

2010-06-15  Pedro Alves  <pedro@codesourcery.com>

	gdb/	
	* Makefile.in (ALL_TARGET_OBS): Remove solib-target.o.
	(SFILES): Remove solib-null.c, add solib-target.c.
	(COMMON_OBS): Remove solib-null.o, add solib-target.o.
	(ALLDEPFILES): Remove solib-target.c.
	* solib-target.c (_initialize_solib_target): Set
	current_target_so_ops to solib_target_so_ops if not already set.
	* solib-null.c: Delete.

---
 gdb/Makefile.in    |    5 +-
 gdb/solib-null.c   |   89 -----------------------------------------------------
 gdb/solib-target.c |    5 ++
 3 files changed, 7 insertions(+), 92 deletions(-)

Index: src/gdb/Makefile.in
===================================================================
--- src.orig/gdb/Makefile.in	2010-06-15 18:08:21.000000000 +0100
+++ src/gdb/Makefile.in	2010-06-15 18:08:23.000000000 +0100
@@ -691,7 +691,7 @@ SFILES = ada-exp.y ada-lang.c ada-typepr
 	scm-exp.c scm-lang.c scm-valprint.c \
 	sentinel-frame.c \
 	serial.c ser-base.c ser-unix.c \
-	solib.c solib-null.c source.c \
+	solib.c solib-target.c source.c \
 	stabsread.c stack.c std-regs.c symfile.c symfile-mem.c symmisc.c \
 	symtab.c \
 	target.c target-descriptions.c target-memory.c \
@@ -859,7 +859,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $
 	reggroups.o regset.o \
 	trad-frame.o \
 	tramp-frame.o \
-	solib.o solib-null.o \
+	solib.o solib-target.o \
 	prologue-value.o memory-map.o xml-support.o xml-syscall.o \
 	target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \
 	inferior.o osdata.o gdb_usleep.o record.o gcore.o \
@@ -1474,7 +1474,6 @@ ALLDEPFILES = \
 	mips64obsd-nat.c mips64obsd-tdep.c \
 	nbsd-nat.c nbsd-tdep.c obsd-tdep.c \
 	solib-osf.c \
-	solib-target.c \
 	somread.c solib-som.c \
 	posix-hdep.c \
 	ppc-sysv-tdep.c ppc-linux-nat.c ppc-linux-tdep.c \
Index: src/gdb/solib-target.c
===================================================================
--- src.orig/gdb/solib-target.c	2010-06-15 18:08:21.000000000 +0100
+++ src/gdb/solib-target.c	2010-06-15 18:08:23.000000000 +0100
@@ -497,4 +497,9 @@ _initialize_solib_target (void)
   solib_target_so_ops.in_dynsym_resolve_code
     = solib_target_in_dynsym_resolve_code;
   solib_target_so_ops.bfd_open = solib_bfd_open;
+
+  /* Set current_target_so_ops to solib_target_so_ops if not already
+     set.  */
+  if (current_target_so_ops == 0)
+    current_target_so_ops = &solib_target_so_ops;
 }
Index: src/gdb/solib-null.c
===================================================================
--- src.orig/gdb/solib-null.c	2010-06-15 18:08:30.000000000 +0100
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,89 +0,0 @@
-/* Definitions for targets without shared libraries for GDB, the GNU Debugger.
-
-   Copyright (C) 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include "defs.h"
-#include "solist.h"
-
-static struct so_list *
-null_current_sos (void)
-{
-  return NULL;
-}
-
-static void
-null_special_symbol_handling (void)
-{
-}
-
-static void
-null_solib_create_inferior_hook (int from_tty)
-{
-}
-
-static void
-null_clear_solib (void)
-{
-}
-
-static void
-null_free_so (struct so_list *so)
-{
-  xfree (so->lm_info);
-}
-
-
-static void
-null_relocate_section_addresses (struct so_list *so,
-                                 struct target_section *sec)
-{
-}
-
-static int
-null_open_symbol_file_object (void *from_ttyp)
-{
-  return 0;
-}
-
-static int
-null_in_dynsym_resolve_code (CORE_ADDR pc)
-{
-  return 0;
-}
-
-static struct target_so_ops null_so_ops;
-
-extern initialize_file_ftype _initialize_null_solib; /* -Wmissing-prototypes */
-
-void
-_initialize_null_solib (void)
-{
-  null_so_ops.relocate_section_addresses = null_relocate_section_addresses;
-  null_so_ops.free_so = null_free_so;
-  null_so_ops.clear_solib = null_clear_solib;
-  null_so_ops.solib_create_inferior_hook = null_solib_create_inferior_hook;
-  null_so_ops.special_symbol_handling = null_special_symbol_handling;
-  null_so_ops.current_sos = null_current_sos;
-  null_so_ops.open_symbol_file_object = null_open_symbol_file_object;
-  null_so_ops.in_dynsym_resolve_code = null_in_dynsym_resolve_code;
-  null_so_ops.bfd_open = solib_bfd_open;
-
-  /* Set current_target_so_ops to null_so_ops if not already set.  */
-  if (current_target_so_ops == 0)
-    current_target_so_ops = &null_so_ops;
-}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Switch shared library default backend to solib-target.c
  2010-06-15 17:59 Switch shared library default backend to solib-target.c Pedro Alves
  2010-06-15 18:05 ` Pedro Alves
@ 2010-06-15 20:37 ` Pedro Alves
  2010-07-21 19:08   ` Pedro Alves
  1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-06-15 20:37 UTC (permalink / raw)
  To: gdb-patches

On Tuesday 15 June 2010 18:58:57, Pedro Alves wrote:
> This patch changes GDB to default to enabling target
> reported shared libraries.  I've applied it.
> 
> It does that by using solib-target.c by default, instead of
> solib-null.c.  The patch actually gets rid of solib-null.c entirely.
> This means that for example, a generic elf gdb build (e.g., arm-eabi, without a
> default OSABI), can be used to debug random RTOSs that report loaded
> shared libraries using the "qXfer:libraries:read" remote protocol
> packet.
> 
> Since solib-target.c behaves exactly the same as solib-null.c
> when the target doesn't implement the TARGET_OBJECT_LIBRARIES
> xfer, this is always either a win, or a nop.

I thought about this a bit and realized that it probably
warrants a NEWS entry.  I'll post one soon.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Switch shared library default backend to solib-target.c
  2010-06-15 20:37 ` Pedro Alves
@ 2010-07-21 19:08   ` Pedro Alves
  2010-07-21 21:16     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-07-21 19:08 UTC (permalink / raw)
  To: gdb-patches, Eli Zaretskii

On Tuesday 15 June 2010 21:37:10, Pedro Alves wrote:
> On Tuesday 15 June 2010 18:58:57, Pedro Alves wrote:
> > This patch changes GDB to default to enabling target
> > reported shared libraries.  I've applied it.
> > 
> > It does that by using solib-target.c by default, instead of
> > solib-null.c.  The patch actually gets rid of solib-null.c entirely.
> > This means that for example, a generic elf gdb build (e.g., arm-eabi, without a
> > default OSABI), can be used to debug random RTOSs that report loaded
> > shared libraries using the "qXfer:libraries:read" remote protocol
> > packet.
> > 
> > Since solib-target.c behaves exactly the same as solib-null.c
> > when the target doesn't implement the TARGET_OBJECT_LIBRARIES
> > xfer, this is always either a win, or a nop.
> 
> I thought about this a bit and realized that it probably
> warrants a NEWS entry.  I'll post one soon.

Is this okay?  (The patch below is against the 7.2 branch.)

-- 
Pedro Alves

2010-07-21  Pedro Alves  <pedro@codesourcery.com>

	* NEWS: Mention target reported shared libraries support by
	default.

---
 gdb/NEWS |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: src/gdb/NEWS
===================================================================
--- src.orig/gdb/NEWS	2010-07-21 19:15:34.000000000 +0100
+++ src/gdb/NEWS	2010-07-21 20:04:09.000000000 +0100
@@ -3,6 +3,14 @@
 
 *** Changes since GDB 7.1
 
+* Shared library support for remote targets by default
+
+  When GDB is configured for a generic, non-OS specific target, like
+  for example, --target=arm-eabi or one of the many *-*-elf targets,
+  GDB now queries remote stubs for loaded shared libraries using the
+  `qXfer:libraries:read' packet.  Previously, shared library support
+  was always disabled for such configurations.
+
 * C++ Improvements:
 
   ** Argument Dependent Lookup (ADL)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Switch shared library default backend to solib-target.c
  2010-07-21 19:08   ` Pedro Alves
@ 2010-07-21 21:16     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2010-07-21 21:16 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Wed, 21 Jul 2010 20:08:14 +0100
> 
> > I thought about this a bit and realized that it probably
> > warrants a NEWS entry.  I'll post one soon.
> 
> Is this okay?

Yes, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-21 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-15 17:59 Switch shared library default backend to solib-target.c Pedro Alves
2010-06-15 18:05 ` Pedro Alves
2010-06-15 20:37 ` Pedro Alves
2010-07-21 19:08   ` Pedro Alves
2010-07-21 21:16     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).