This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, gdbserver] Further cleanup of FDPIC/DSBT divergences


Hi,

On 08/09/2013 09:32 PM, Yao Qi wrote:
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.

I seem to recall the code to read target memory, in the case of targets that do relocations based on loadmaps, get this information wrong, based on past experience with a different DSBT-based target.

From what i recall, it tries to read the dsbt_index from the main executable's .dynamic, but the information is in the solib's .dynamic section.

I can't be sure it works for c6x since there is no target for me to test on. If someone has access to that, i can coordinate some testing. This is the biggest problem right now.



+/* 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.

Fixed.


+
+  /* 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.


That is exactly what it is. I named it DT_TIC6X_DSBT_INDEX to make it more meaningful, but i can use DT_C6000_DSBT_INDEX without problems i think.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]