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]

[RFA] windows-nat.c: Better failure handling of GetThreadSelectorEntry call


  It seems that, at least for Windows 2008,
GetThreadSelectorEntry does not work for 64-bit programs,
which doesn't really surprise me as the struct LDT_ENTRY
is 32-bit specific.
  I first thought, let's disable this for win64, but
after I thought, maybe later we will support 32-bit debugging
on Windows-64 (possible according to Windows API).

  So I preferred to call GetLastError, and give a
more precise failure message in that case.

  Is this OK?

Pierre Muller
Pascal language support maintainer for GDB

2010-05-21  Pierre Muller  <muller@ics.u-strasbg.fr>

	* windows-nat.c (display_selector): Call GetLastError to
	give better failure explanation.

Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.208
diff -u -p -r1.208 windows-nat.c
--- windows-nat.c	16 Apr 2010 07:49:35 -0000	1.208
+++ windows-nat.c	21 May 2010 21:08:09 -0000
@@ -1032,7 +1032,11 @@ display_selector (HANDLE thread, DWORD s
     }
   else
     {
-      printf_filtered ("Invalid selector 0x%lx.\n",sel);
+      DWORD err = GetLastError ();
+      if (err == ERROR_NOT_SUPPORTED)
+	printf_filtered ("Function not supported\n");
+      else
+	printf_filtered ("Invalid selector 0x%lx.\n",sel);
       return 0;
     }
 }


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