* linux-low.c: Move definition checks upwards for PT_TEXT_ADDR,
authorLuis Machado <luisgpm@br.ibm.com>
Thu, 16 May 2013 10:31:49 +0000 (10:31 +0000)
committerLuis Machado <luisgpm@br.ibm.com>
Thu, 16 May 2013 10:31:49 +0000 (10:31 +0000)
PT_DATA_ADDR and PT_TEXT_END_ADDR.  Update comments.
(linux_read_offsets): Remove PT_TEXT_ADDR, PT_DATA_ADDR and
PT_TEXT_END_ADDR guards.  Update comments.
(linux_target_op) <read_offsets>: Conditionally define to
linux_read_offsets if the target is UCLIBC and if it defines
PT_TEXT_ADDR, PT_DATA_ADDR and PT_TEXT_END_ADDR.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c

index ffedda0682b6e9d61b1b1a6daa27426fcbb6f8b9..7f284c9adadf19bce6b34cf2f3fcd197790bfc66 100644 (file)
@@ -1,3 +1,13 @@
+2013-05-16  Luis Machado  <lgustavo@codesourcery.com>
+
+       * linux-low.c: Move definition checks upwards for PT_TEXT_ADDR,
+       PT_DATA_ADDR and PT_TEXT_END_ADDR.  Update comments.
+       (linux_read_offsets): Remove PT_TEXT_ADDR, PT_DATA_ADDR and
+       PT_TEXT_END_ADDR guards.  Update comments.
+       (linux_target_op) <read_offsets>: Conditionally define to
+       linux_read_offsets if the target is UCLIBC and if it defines
+       PT_TEXT_ADDR, PT_DATA_ADDR and PT_TEXT_END_ADDR.
+
 2013-05-06  Sandra Loosemore  <sandra@codesourcery.com>
            Andrew Jenner  <andrew@codesourcery.com>
 
index 72c51e0e9cc3803edd38c926b6d3945009404b3d..b01b37cb74c9e40a7adca0558455b6b35b2e4695 100644 (file)
 #endif
 #endif
 
+/* Some targets did not define these ptrace constants from the start,
+   so gdbserver defines them locally here.  In the future, these may
+   be removed after they are added to asm/ptrace.h.  */
+#if !(defined(PT_TEXT_ADDR) \
+      || defined(PT_DATA_ADDR) \
+      || defined(PT_TEXT_END_ADDR))
+#if defined(__mcoldfire__)
+/* These are still undefined in 3.10 kernels.  */
+#define PT_TEXT_ADDR 49*4
+#define PT_DATA_ADDR 50*4
+#define PT_TEXT_END_ADDR  51*4
+/* BFIN already defines these since at least 2.6.32 kernels.  */
+#elif defined(BFIN)
+#define PT_TEXT_ADDR 220
+#define PT_TEXT_END_ADDR 224
+#define PT_DATA_ADDR 228
+/* These are still undefined in 3.10 kernels.  */
+#elif defined(__TMS320C6X__)
+#define PT_TEXT_ADDR     (0x10000*4)
+#define PT_DATA_ADDR     (0x10004*4)
+#define PT_TEXT_END_ADDR (0x10008*4)
+#endif
+#endif
+
 #ifdef HAVE_LINUX_BTRACE
 # include "linux-btrace.h"
 #endif
@@ -4833,25 +4857,14 @@ linux_stopped_data_address (void)
   return lwp->stopped_data_address;
 }
 
-#if defined(__UCLIBC__) && defined(HAS_NOMMU)
-#if ! (defined(PT_TEXT_ADDR) \
-       || defined(PT_DATA_ADDR) \
-       || defined(PT_TEXT_END_ADDR))
-#if defined(__mcoldfire__)
-/* These should really be defined in the kernel's ptrace.h header.  */
-#define PT_TEXT_ADDR 49*4
-#define PT_DATA_ADDR 50*4
-#define PT_TEXT_END_ADDR  51*4
-#elif defined(BFIN)
-#define PT_TEXT_ADDR 220
-#define PT_TEXT_END_ADDR 224
-#define PT_DATA_ADDR 228
-#elif defined(__TMS320C6X__)
-#define PT_TEXT_ADDR     (0x10000*4)
-#define PT_DATA_ADDR     (0x10004*4)
-#define PT_TEXT_END_ADDR (0x10008*4)
-#endif
-#endif
+#if defined(__UCLIBC__) && defined(HAS_NOMMU)        \
+    && defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) \
+    && defined(PT_TEXT_END_ADDR)
+
+/* This is only used for targets that define PT_TEXT_ADDR,
+   PT_DATA_ADDR and PT_TEXT_END_ADDR.  If those are not defined, supposedly
+   the target has different ways of acquiring this information, like
+   loadmaps.  */
 
 /* Under uClinux, programs are loaded at non-zero offsets, which we need
    to tell gdb about.  */
@@ -4859,7 +4872,6 @@ linux_stopped_data_address (void)
 static int
 linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
 {
-#if defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) && defined(PT_TEXT_END_ADDR)
   unsigned long text, text_end, data;
   int pid = lwpid_of (get_thread_lwp (current_inferior));
 
@@ -4888,7 +4900,6 @@ linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
 
       return 1;
     }
-#endif
  return 0;
 }
 #endif
@@ -5887,7 +5898,9 @@ static struct target_ops linux_target_ops = {
   linux_remove_point,
   linux_stopped_by_watchpoint,
   linux_stopped_data_address,
-#if defined(__UCLIBC__) && defined(HAS_NOMMU)
+#if defined(__UCLIBC__) && defined(HAS_NOMMU)        \
+    && defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) \
+    && defined(PT_TEXT_END_ADDR)
   linux_read_offsets,
 #else
   NULL,
This page took 0.03282 seconds and 4 git commands to generate.