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: [commit] Fix gdb crashes when using target extended-remote against linux gdbserver.


All that talk, and in the end...

On Friday 06 February 2009 01:31:01, Pedro Alves wrote:

> Index: src/gdb/target.c
> ===================================================================
> --- src.orig/gdb/target.c	2009-02-06 00:55:23.000000000 +0000
> +++ src/gdb/target.c	2009-02-06 00:55:34.000000000 +0000
> @@ -2218,18 +2218,15 @@ target_get_osdata (const char *type)
>    char *document;
>    struct target_ops *t;
>  
> -  if (target_can_run (&current_target))
> -    t = &current_target;
> -  else
> +  if (current_target.to_stratum == dummy_stratum)
>      t = find_default_run_target ("get OS data");
> +  else
> +    t = current_target.beneath;
>  

... this didn't take into the account the file_stratum.  The below
fixed it.  Checked in.

Oh the day I get things right the first time...

-- 
Pedro Alves

2009-02-06  Pedro Alves  <pedro@codesourcery.com>

	* target.c (target_get_osdata): Check for equal or higher than
	process_stratum, not dummy_stratum.

---
 gdb/target.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Index: src/gdb/target.c
===================================================================
--- src.orig/gdb/target.c	2009-02-06 02:01:47.000000000 +0000
+++ src/gdb/target.c	2009-02-06 02:02:59.000000000 +0000
@@ -2218,10 +2218,13 @@ target_get_osdata (const char *type)
   char *document;
   struct target_ops *t;
 
-  if (current_target.to_stratum == dummy_stratum)
-    t = find_default_run_target ("get OS data");
-  else
+  /* If we're already connected to something that can get us OS
+     related data, use it.  Otherwise, try using the native
+     target.  */
+  if (current_target.to_stratum >= process_stratum)
     t = current_target.beneath;
+  else
+    t = find_default_run_target ("get OS data");
 
   if (!t)
     return NULL;


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