Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Implement qXfer:libraries for Linux/gdbserver
Date: Mon, 08 Aug 2011 21:10:00 -0000	[thread overview]
Message-ID: <20110808210938.GA19337@host1.jankratochvil.net> (raw)
In-Reply-To: <CALoOobM_nZ+Xkv7tqjq-JLOaPSQabOTKnXx29HADOtfQk_Jgrg@mail.gmail.com>

Hi Paul,

with:
./gdbserver :1234 ~/t/pause64 
../gdb ~/t/pause64 -ex 'target remote localhost:1234' -ex 'b main' -ex c

it falls back back memory-transfers as DT_DEBUG is zero initially at _start.

just to get the patch integrated on some final patches assembly.


Thanks,
Jan


gdb/gdbserver/
2011-08-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix initial zero DT_DEBUG.
	* linux-low.c (linux_add_process): Remove r_debug initialization.
	(get_r_debug): Update function comment.  Return -1 when DT_DEBUG is not
	found.
	(linux_qxfer_libraries): Call get_r_debug on -1 (not 0).  Return on
	both -1 or 0.

--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -264,7 +264,6 @@ linux_add_process (int pid, int attached)
 
   proc = add_process (pid, attached);
   proc->private = xcalloc (1, sizeof (*proc->private));
-  proc->private->r_debug = (CORE_ADDR) -1;
 
   if (the_low_target.new_process != NULL)
     proc->private->arch_private = the_low_target.new_process ();
@@ -4863,7 +4862,8 @@ get_dynamic (const int pid, const int is_elf64)
   return 0;
 }
 
-/* Return &_r_debug in the inferior, or 0 if not present.  */
+/* Return &_r_debug in the inferior, or -1 if not present.  Return value
+   can be 0 if the inferior does not yet have the library list initialized.  */
 
 static CORE_ADDR
 get_r_debug (const int pid, const int is_elf64)
@@ -4874,7 +4874,7 @@ get_r_debug (const int pid, const int is_elf64)
 
   dynamic_memaddr = get_dynamic (pid, is_elf64);
   if (dynamic_memaddr == 0)
-    return 0;
+    return (CORE_ADDR) -1;
 
   while (linux_read_memory (dynamic_memaddr, buf, dyn_size) == 0)
     {
@@ -4981,12 +4981,10 @@ linux_qxfer_libraries (const char *annex, unsigned char *readbuf,
   is_elf64 = elf_64_file_p (filename);
   lmo = is_elf64 ? &lmo_64bit_offsets : &lmo_32bit_offsets;
 
-  if (priv->r_debug == (CORE_ADDR) -1)
+  if (priv->r_debug == 0)
     priv->r_debug = get_r_debug (pid, is_elf64);
 
-  gdb_assert (priv->r_debug != (CORE_ADDR) -1);
-
-  if (priv->r_debug == 0)
+  if (priv->r_debug == (CORE_ADDR) -1 || priv->r_debug == 0)
     {
       document = xstrdup ("<library-list/>\n");
     }


  parent reply	other threads:[~2011-08-08 21:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 18:11 [patch] Implement qXfer:libraries for Linux/gdbserver [Was: Re: [RFC] Make target_read_string faster over high-latency links.] Paul Pluzhnikov
2011-08-08 18:36 ` Jan Kratochvil
2011-08-08 18:56   ` Paul Pluzhnikov
2011-08-08 21:24     ` [patch] Implement qXfer:libraries for Linux/gdbserver Jan Kratochvil
2011-08-09 18:25       ` Daniel Jacobowitz
2011-08-08 21:10 ` Jan Kratochvil [this message]
2011-08-08 21:31   ` Paul Pluzhnikov
2011-08-08 21:38     ` Jan Kratochvil
2011-08-08 23:50       ` Paul Pluzhnikov
2011-08-09  9:07         ` Jan Kratochvil
2011-08-09 16:57           ` Paul Pluzhnikov
2011-08-14 16:36             ` Jan Kratochvil
2011-10-03 21:57               ` IMO-obsolste: " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110808210938.GA19337@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ppluzhnikov@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox