GDBserver
/home/stan/gdb/src/gdb/gdbserver/win32-low.h
Go to the documentation of this file.
00001 /* Internal interfaces for the Win32 specific target code for gdbserver.
00002    Copyright (C) 2007-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #include <windows.h>
00020 
00021 struct target_desc;
00022 
00023 /* The inferior's target description.  This is a global because the
00024    Windows ports support neither bi-arch nor multi-process.  */
00025 extern const struct target_desc *win32_tdesc;
00026 
00027 /* Thread information structure used to track extra information about
00028    each thread.  */
00029 typedef struct win32_thread_info
00030 {
00031   /* The Win32 thread identifier.  */
00032   DWORD tid;
00033 
00034   /* The handle to the thread.  */
00035   HANDLE h;
00036 
00037   /* Thread Information Block address.  */
00038   CORE_ADDR thread_local_base;
00039 
00040   /* Non zero if SuspendThread was called on this thread.  */
00041   int suspended;
00042 
00043 #ifdef _WIN32_WCE
00044   /* The context as retrieved right after suspending the thread. */
00045   CONTEXT base_context;
00046 #endif
00047 
00048   /* The context of the thread, including any manipulations.  */
00049   CONTEXT context;
00050 } win32_thread_info;
00051 
00052 struct win32_target_ops
00053 {
00054   /* Architecture-specific setup.  */
00055   void (*arch_setup) (void);
00056 
00057   /* The number of target registers.  */
00058   int num_regs;
00059 
00060   /* Perform initializations on startup.  */
00061   void (*initial_stuff) (void);
00062 
00063   /* Fetch the context from the inferior.  */
00064   void (*get_thread_context) (win32_thread_info *th,
00065                               DEBUG_EVENT *current_event);
00066 
00067   /* Flush the context back to the inferior.  */
00068   void (*set_thread_context) (win32_thread_info *th,
00069                               DEBUG_EVENT *current_event);
00070 
00071   /* Called when a thread was added.  */
00072   void (*thread_added) (win32_thread_info *th);
00073 
00074   /* Fetch register from gdbserver regcache data.  */
00075   void (*fetch_inferior_register) (struct regcache *regcache,
00076                                    win32_thread_info *th, int r);
00077 
00078   /* Store a new register value into the thread context of TH.  */
00079   void (*store_inferior_register) (struct regcache *regcache,
00080                                    win32_thread_info *th, int r);
00081 
00082   void (*single_step) (win32_thread_info *th);
00083 
00084   const unsigned char *breakpoint;
00085   int breakpoint_len;
00086 
00087   /* Breakpoint/Watchpoint related functions.  See target.h for comments.  */
00088   int (*insert_point) (char type, CORE_ADDR addr, int len);
00089   int (*remove_point) (char type, CORE_ADDR addr, int len);
00090   int (*stopped_by_watchpoint) (void);
00091   CORE_ADDR (*stopped_data_address) (void);
00092 };
00093 
00094 extern struct win32_target_ops the_low_target;
00095 
00096 /* Map the Windows error number in ERROR to a locale-dependent error
00097    message string and return a pointer to it.  Typically, the values
00098    for ERROR come from GetLastError.
00099 
00100    The string pointed to shall not be modified by the application,
00101    but may be overwritten by a subsequent call to strwinerror
00102 
00103    The strwinerror function does not change the current setting
00104    of GetLastError.  */
00105 extern char * strwinerror (DWORD error);
00106 
00107 /* in wincecompat.c */
00108 
00109 extern void to_back_slashes (char *);
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines