This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, gdbserver] Further cleanup of FDPIC/DSBT divergences
- From: Yao Qi <yao at codesourcery dot com>
- To: <lgustavo at codesourcery dot com>
- Cc: Pedro Alves <palves at redhat dot com>, "'gdb-patches at sourceware dot org'" <gdb-patches at sourceware dot org>, Mike Frysinger <vapier at gentoo dot org>
- Date: Sat, 10 Aug 2013 08:32:23 +0800
- Subject: Re: [PATCH, gdbserver] Further cleanup of FDPIC/DSBT divergences
- References: <51C34F14 dot 8070803 at codesourcery dot com> <51C84CBD dot 10506 at codesourcery dot com> <51C84DD4 dot 4090001 at codesourcery dot com> <5203CA36 dot 5000206 at codesourcery dot com> <520505D9 dot 8080103 at redhat dot com> <520524D8 dot 40408 at codesourcery dot com>
On 08/10/2013 01:20 AM, Luis Machado wrote:
+/* Scan for DYNTAG in .dynamic section of ABFD. If DYNTAG is found 1
+ is returned and the corresponding PTR is set. We only search in
+ the BFD, not in the target's memory. */
+
+static int
+scan_dyntag_in_bfd (int dyntag, bfd *abfd, CORE_ADDR *ptr)
Luis,
We've already have a function scan_dyntag in solib-dsbt.c which reads
in both BFD and the target memory. There are some duplications in
scan_dyntag and scan_dyntag_in_bfd. We can combine them into one
function, probably.
+/* Given a shared library filename, load it up and find
+ out what is its dsbt index. */
+
+static int
+fetch_solib_dsbt_index (const char *filename)
+{
+ unsigned long dsbt_index;
+ CORE_ADDR addr;
+ bfd *solib_bfd = NULL;
+ volatile struct gdb_exception ex;
+
+ if (filename == NULL)
+ return -1;
+
+ /* Open the shared library. */
+ TRY_CATCH (ex, RETURN_MASK_ALL)
+ {
+ solib_bfd = solib_bfd_open ((char *) filename);
+ }
+ if (solib_bfd == NULL)
+ {
+ return -1;
+ }
Unnecessary braces.
+
+ /* Fetch the DSBT_INDEX from the shared library file on disk. */
+ if (scan_dyntag_in_bfd (DT_TIC6X_DSBT_INDEX, solib_bfd, &addr) == 0)
I don't find the definition of DT_TIC6X_DSBT_INDEX. In uclibc, I only
find DT_C6000_DSBT_INDEX.
@@ -684,24 +795,50 @@ dsbt_current_sos (void)
sizeof lm_buf.l_addr.map,
byte_order);
- ret = target_read_memory (map_addr + 12, (gdb_byte *) &indexword,
- sizeof indexword);
- if (ret)
+ /* Fetch the name. */
+ addr = extract_unsigned_integer (lm_buf.l_name,
+ sizeof (lm_buf.l_name),
+ byte_order);
+ target_read_string (addr, &name_buf, SO_NAME_MAX_PATH_SIZE - 1,
+ &errcode);
+
+ if (errcode != 0)
{
- warning (_("dsbt_current_sos: Unable to read dsbt index."
- " Shared object chain may be incomplete."));
- break;
+ warning (_("dsbt_current_sos: Can't read pathname for link "
+ "map entry: %s."), safe_strerror (errcode));
+
+ /* Since we do not have a pathname, just assume that
+ dsbt_index equals a dummy value of 1. This way we can
^^ -1?
--
Yao (éå)