Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RE: [patch] gdbserver fails on 32-bit ppc rfs running in a-64 bit 2.6 linux kernel
@ 2005-03-16 16:54 Jitendra Pawar
  2005-03-16 16:57 ` Daniel Jacobowitz
  0 siblings, 1 reply; 18+ messages in thread
From: Jitendra Pawar @ 2005-03-16 16:54 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches

Hi,

>On Tue, Mar 15, 2005 at 06:36:22PM +0530, Amit S. Kale wrote:
>> The strtoul change in my patch was already present. Sorry about that.
>> 
>> You have changed the data type of thread_resume::thread as well as cont_thread 
>> to unsigned long. "cont_thread = -1" and "(cont_thread > 0)" are still in 
>> place. How does this work?
>
>Hmm, looks like you found a real problem here; would you like to fix
>it?  Modern GDBs don't heavily use this code, because of the vCont
>packet.  Otherwise I'll fix it, but I may not find time for a bit.
>

I have understood the problem and I'll like to fix it. shall I do it?

- Jitendra

>> Can we use a thread value of "0" to indicate all threads or no-thread instead 
>> of "-1"? The condition "cont_thread > 0" becomes valid if we do that.
>
>This value can be set from the remote protocol, so we would have to
>transform it in Hc/Hg support also.




^ permalink raw reply	[flat|nested] 18+ messages in thread
* [patch] gdbserver fails on 32-bit ppc rfs running in a-64 bit 2.6 linux kernel
@ 2005-03-14 16:07 Amit S. Kale
  2005-03-14 16:23 ` Daniel Jacobowitz
  0 siblings, 1 reply; 18+ messages in thread
From: Amit S. Kale @ 2005-03-14 16:07 UTC (permalink / raw)
  To: GDB patches

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

Hi,

I found that gdbserver fails on a 32-bit ppc rfs running in a 64-bit 2.6 linux 
kernel. The thread id's fetched from thread-db library are above 0x7fffffff. 
gdbserver has implicit assumptions that thread id's are "signed integers". 
This is true when running under a 32-bit kernel, but not true here. Attached 
patch fixes this problem by changing the "strtol" that scans the thread-id to 
"strtoul" and by changing the "cont_thread > 0" comparison to "cont_thread != 
-1".

Is there any likelyhood of this assumption being made in some other places in 
gdbserver or gdb?

Thanks.
-Amit

[-- Attachment #2: threadidrange.patch --]
[-- Type: text/x-diff, Size: 1685 bytes --]

Index: src/gdb/gdbserver/linux-low.c
===================================================================
--- src.orig/gdb/gdbserver/linux-low.c	2005-03-10 19:31:24.000000000 +0530
+++ src/gdb/gdbserver/linux-low.c	2005-03-14 20:49:11.589413080 +0530
@@ -667,7 +667,7 @@
      then we need to make sure we restart the other threads.  We could
      pick a thread at random or restart all; restarting all is less
      arbitrary.  */
-  if (cont_thread > 0)
+  if (cont_thread != -1)
     {
       child = (struct thread_info *) find_inferior_id (&all_threads,
 						       cont_thread);
@@ -1430,7 +1430,7 @@
 {
   extern unsigned long signal_pid;
 
-  if (cont_thread > 0)
+  if (cont_thread != -1)
     {
       struct process_info *process;
 
Index: src/gdb/gdbserver/server.c
===================================================================
--- src.orig/gdb/gdbserver/server.c	2005-03-10 19:31:24.000000000 +0530
+++ src/gdb/gdbserver/server.c	2005-03-14 21:05:22.774770464 +0530
@@ -193,7 +193,7 @@
       if (p[0] == 'S' || p[0] == 'C')
 	{
 	  int sig;
-	  sig = strtol (p + 1, &q, 16);
+	  sig = strtoul (p + 1, &q, 16);
 	  if (p == q)
 	    goto err;
 	  p = q;
@@ -281,7 +281,7 @@
   struct thread_resume resume_info[2];
   int n = 0;
 
-  if (step || sig || cont_thread > 0)
+  if (step || sig || cont_thread != -1)
     {
       resume_info[0].thread
 	= ((struct inferior_list_entry *) current_inferior)->id;
@@ -293,7 +293,7 @@
   resume_info[n].thread = -1;
   resume_info[n].step = 0;
   resume_info[n].sig = 0;
-  resume_info[n].leave_stopped = (cont_thread > 0);
+  resume_info[n].leave_stopped = (cont_thread != -1);
 
   (*the_target->resume) (resume_info);
 }

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

end of thread, other threads:[~2005-06-17  4:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-16 16:54 [patch] gdbserver fails on 32-bit ppc rfs running in a-64 bit 2.6 linux kernel Jitendra Pawar
2005-03-16 16:57 ` Daniel Jacobowitz
2005-03-22 14:11   ` Jitendra Pawar
2005-03-22 14:23     ` Daniel Jacobowitz
2005-03-22 14:50       ` Jitendra Pawar
2005-03-22 14:54         ` Daniel Jacobowitz
2005-03-23 10:03           ` Jitendra Pawar
2005-03-23 15:43             ` Daniel Jacobowitz
2005-03-24 13:42               ` Jitendra Pawar
2005-03-24 14:02                 ` Daniel Jacobowitz
2005-03-22 18:49     ` Mark Kettenis
  -- strict thread matches above, loose matches on Subject: below --
2005-03-14 16:07 Amit S. Kale
2005-03-14 16:23 ` Daniel Jacobowitz
2005-03-14 16:57   ` Christopher Faylor
2005-03-14 17:02     ` Daniel Jacobowitz
2005-03-15 13:07   ` Amit S. Kale
2005-03-16  3:16     ` Daniel Jacobowitz
2005-06-17  4:00       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox