diff options
| author | Yuanjie Huang <yuanjie.huang@windriver.com> | 2015-07-08 11:15:11 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-09 18:00:18 +0100 |
| commit | 925397f6a1ff6dcfbaa32cb4540ba2d5681998f4 (patch) | |
| tree | d1fc35e8954c0aed0261f2af2281701bf0e147c3 | |
| parent | 05b02d27d2115c0af32988bb3b43286f7943471c (diff) | |
| download | poky-925397f6a1ff6dcfbaa32cb4540ba2d5681998f4.tar.gz | |
gdb: Fix detection of 64-bit PPC inferior in gdbserver
Fix 64-bit detection according to PowerISA Boot III-S.
https://sourceware.org/ml/gdb-patches/2014-12/msg00239.html
Written by: Yao Qi <yao@codesourcery.com>
(From OE-Core rev: c82557d2bf8c3d8081754561df46cba530103164)
Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/gdb/gdb.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/gdb/gdb/fix-detection-of-64-bit-PPC-inferior-in-gdbserver.patch | 56 |
2 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc index 5466a7dff8..88c0213b44 100644 --- a/meta/recipes-devtools/gdb/gdb.inc +++ b/meta/recipes-devtools/gdb/gdb.inc | |||
| @@ -4,6 +4,7 @@ inherit gettext | |||
| 4 | 4 | ||
| 5 | SRC_URI += "file://0002-Change-order-of-CFLAGS.patch \ | 5 | SRC_URI += "file://0002-Change-order-of-CFLAGS.patch \ |
| 6 | file://0003-Add-support-for-Renesas-SH-sh4-architecture.patch \ | 6 | file://0003-Add-support-for-Renesas-SH-sh4-architecture.patch \ |
| 7 | file://fix-detection-of-64-bit-PPC-inferior-in-gdbserver.patch \ | ||
| 7 | " | 8 | " |
| 8 | #LDFLAGS_append = " -s" | 9 | #LDFLAGS_append = " -s" |
| 9 | #export CFLAGS_append=" -L${STAGING_LIBDIR}" | 10 | #export CFLAGS_append=" -L${STAGING_LIBDIR}" |
diff --git a/meta/recipes-devtools/gdb/gdb/fix-detection-of-64-bit-PPC-inferior-in-gdbserver.patch b/meta/recipes-devtools/gdb/gdb/fix-detection-of-64-bit-PPC-inferior-in-gdbserver.patch new file mode 100644 index 0000000000..2854352309 --- /dev/null +++ b/meta/recipes-devtools/gdb/gdb/fix-detection-of-64-bit-PPC-inferior-in-gdbserver.patch | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | From 4fe67dbafa1bee679daecc12ed30621d5c2605de Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yao Qi <yao@codesourcery.com> | ||
| 3 | Date: Mon, 11 May 2015 10:57:33 +0800 | ||
| 4 | Subject: [PATCH] Fix detection of 64-bit PPC inferior in gdbserver | ||
| 5 | |||
| 6 | Issue #16775 | ||
| 7 | |||
| 8 | * gdbserver/linux-ppc-low.c (ppc_arch_setup): Change variable msr to type | ||
| 9 | 'unsigned long'. Check bit 63 or bit 31 is one. | ||
| 10 | |||
| 11 | https://sourceware.org/ml/gdb-patches/2014-12/msg00239.html | ||
| 12 | Written by: Yao Qi <yao@codesourcery.com> | ||
| 13 | |||
| 14 | Upstream-Status: Pending | ||
| 15 | |||
| 16 | Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com> | ||
| 17 | --- | ||
| 18 | gdb/gdbserver/linux-ppc-low.c | 11 +++++++---- | ||
| 19 | 1 file changed, 7 insertions(+), 4 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c | ||
| 22 | index 63d4218..a62cf22 100644 | ||
| 23 | --- a/gdb/gdbserver/linux-ppc-low.c | ||
| 24 | +++ b/gdb/gdbserver/linux-ppc-low.c | ||
| 25 | @@ -374,7 +374,7 @@ ppc_arch_setup (void) | ||
| 26 | { | ||
| 27 | const struct target_desc *tdesc; | ||
| 28 | #ifdef __powerpc64__ | ||
| 29 | - long msr; | ||
| 30 | + unsigned long msr; | ||
| 31 | struct regcache *regcache; | ||
| 32 | |||
| 33 | /* On a 64-bit host, assume 64-bit inferior process with no | ||
| 34 | @@ -384,13 +384,16 @@ ppc_arch_setup (void) | ||
| 35 | current_process ()->tdesc = tdesc; | ||
| 36 | ppc_hwcap = 0; | ||
| 37 | |||
| 38 | - /* Only if the high bit of the MSR is set, we actually have | ||
| 39 | - a 64-bit inferior. */ | ||
| 40 | + /* We actually have a 64-bit inferior only if the certain bit of the | ||
| 41 | + MSR is set. The PowerISA Book III-S MSR is different from the | ||
| 42 | + PowerISA Book III-E MSR. The Book III-S MSR is 64 bits wide, and | ||
| 43 | + its MSR[SF] is the bit 0 of a 64-bit value. Book III-E MSR is 32 | ||
| 44 | + bits wide, and its MSR[CM] is the bit 0 of a 32-bit value. */ | ||
| 45 | regcache = new_register_cache (tdesc); | ||
| 46 | fetch_inferior_registers (regcache, find_regno (tdesc, "msr")); | ||
| 47 | collect_register_by_name (regcache, "msr", &msr); | ||
| 48 | free_register_cache (regcache); | ||
| 49 | - if (msr < 0) | ||
| 50 | + if (msr & 0x8000000080000000) | ||
| 51 | { | ||
| 52 | ppc_get_hwcap (&ppc_hwcap); | ||
| 53 | if (ppc_hwcap & PPC_FEATURE_CELL) | ||
| 54 | -- | ||
| 55 | 1.8.5.2.233.g932f7e4 | ||
| 56 | |||
