diff mbox series

[for-master] package/gdb: include gdbarch.h in xtensa-linux-nat.c

Message ID 20220829202159.407642-1-romain.naour@gmail.com
State Accepted
Headers show
Series [for-master] package/gdb: include gdbarch.h in xtensa-linux-nat.c | expand

Commit Message

Romain Naour Aug. 29, 2022, 8:21 p.m. UTC
It seems that gdb doesn't build for xtensa since a while, indeed commit
[1] merged in gdb 9 introduced a few number of build issues on several
architectures:

[Fix gdb build on macOS]
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b1c896b365f2dbcd14145a88d103623244cf0fb0

[gdb: Fix gdb build on mips64-linux]
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=2208ee917050bcc901c7faefdee257ffbf8ef2ab

[gdb: Fix native build on Linux/Alpha.]
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231

[Include gdbarch.h in m68k-linux-nat.c]
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a7cdaa914f4b937544d8f102679bb5129bb1ef08

[gdb: include gdbarch.h in hppa-linux-nat.c]
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ad75efa628656716982f2674008952bfd2c268af

Most of them has been fixed before the gdb 9 release but it seems
that xtensa is the last one on this list and still unfixed with
gdb 11 (not even noticed by Buildroot autobuilders).

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=0d12e84cfc9bd36b7bbda01a3c8f83f65a832398

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
---
gcc 12 is also broken due to too old xtensa overlay for gdb:

xtensa overlays form 2016 override gdb/xtensa-config.c breaking
the gdb 12 build due a recent changes from commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=345bd07cce33565f1cd66acabdaf387ca3a7ccb3
---
 .../0009-gdb-Fix-native-build-on-xtensa.patch | 57 +++++++++++++++++++
 .../0009-gdb-Fix-native-build-on-xtensa.patch | 57 +++++++++++++++++++
 .../0009-gdb-Fix-native-build-on-xtensa.patch | 57 +++++++++++++++++++
 3 files changed, 171 insertions(+)
 create mode 100644 package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch
 create mode 100644 package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch
 create mode 100644 package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch

Comments

Yann E. MORIN Sept. 6, 2022, 3:50 p.m. UTC | #1
Romain, All,

On 2022-08-29 22:21 +0200, Romain Naour spake thusly:
> It seems that gdb doesn't build for xtensa since a while, indeed commit
> [1] merged in gdb 9 introduced a few number of build issues on several
> architectures:
> 
> [Fix gdb build on macOS]
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b1c896b365f2dbcd14145a88d103623244cf0fb0
> 
> [gdb: Fix gdb build on mips64-linux]
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=2208ee917050bcc901c7faefdee257ffbf8ef2ab
> 
> [gdb: Fix native build on Linux/Alpha.]
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
> 
> [Include gdbarch.h in m68k-linux-nat.c]
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a7cdaa914f4b937544d8f102679bb5129bb1ef08
> 
> [gdb: include gdbarch.h in hppa-linux-nat.c]
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ad75efa628656716982f2674008952bfd2c268af
> 
> Most of them has been fixed before the gdb 9 release but it seems
> that xtensa is the last one on this list and still unfixed with
> gdb 11 (not even noticed by Buildroot autobuilders).
> 
> [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=0d12e84cfc9bd36b7bbda01a3c8f83f65a832398
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Max Filippov <jcmvbkbc@gmail.com>

Applied to master, thanks.

> ---
> gcc 12 is also broken due to too old xtensa overlay for gdb:
> 
> xtensa overlays form 2016 override gdb/xtensa-config.c breaking
> the gdb 12 build due a recent changes from commit:
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=345bd07cce33565f1cd66acabdaf387ca3a7ccb3

Should we mask out gdb-12 for xtensa in next, then?

Regards,
Yann E. MORIN.

> ---
>  .../0009-gdb-Fix-native-build-on-xtensa.patch | 57 +++++++++++++++++++
>  .../0009-gdb-Fix-native-build-on-xtensa.patch | 57 +++++++++++++++++++
>  .../0009-gdb-Fix-native-build-on-xtensa.patch | 57 +++++++++++++++++++
>  3 files changed, 171 insertions(+)
>  create mode 100644 package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch
>  create mode 100644 package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch
>  create mode 100644 package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch
> 
> diff --git a/package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch b/package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch
> new file mode 100644
> index 0000000000..927bf20de5
> --- /dev/null
> +++ b/package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch
> @@ -0,0 +1,57 @@
> +From 02d9e6a3bc47dfe138ef4511aaeeae26b7dbd1ba Mon Sep 17 00:00:00 2001
> +From: Romain Naour <romain.naour@gmail.com>
> +Date: Sun, 28 Aug 2022 23:21:37 +0200
> +Subject: [PATCH] gdb: Fix native build on xtensa
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Apply a similar fix than for Alpha architecture on gdb 9:
> +https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
> +
> +Fixes:
> +
> +../../gdb/xtensa-linux-nat.c: In function ‘void fill_gregset(const regcache*, elf_greg_t (*)[128], int)’:
> +../../gdb/xtensa-linux-nat.c:66:17: error: ‘gdbarch_pc_regnum’ was not declared in this scope
> +   66 |   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
> +      |                 ^~~~~~~~~~~~~~~~~
> +  CXX    complaints.o
> +../../gdb/xtensa-linux-nat.c:68:17: error: ‘gdbarch_ps_regnum’ was not declared in this scope
> +   68 |   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
> +      |                 ^~~~~~~~~~~~~~~~~
> +../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
> +   71 |   if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
> +      |                                      ^
> +In file included from ../../gdb/xtensa-linux-nat.c:38:
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘gdbarch_tdep::gdbarch_tdep()’
> +  160 | struct gdbarch_tdep
> +      |        ^~~~~~~~~~~~
> +../../gdb/xtensa-tdep.h:160:8: note:   candidate expects 0 arguments, 1 provided
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)’
> +../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘const gdbarch_tdep&’
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)’
> +../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘gdbarch_tdep&&’
> +../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
> +   72 |     regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
> +      |                                                 ^
> +
> +Signed-off-by: Romain Naour <romain.naour@gmail.com>
> +---
> + gdb/xtensa-linux-nat.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
> +index b2b3db182bc..b230e08b69f 100644
> +--- a/gdb/xtensa-linux-nat.c
> ++++ b/gdb/xtensa-linux-nat.c
> +@@ -36,6 +36,7 @@
> + 
> + #include "gregset.h"
> + #include "xtensa-tdep.h"
> ++#include "gdbarch.h"
> + 
> + /* Defines ps_err_e, struct ps_prochandle.  */
> + #include "gdb_proc_service.h"
> +-- 
> +2.37.2
> +
> diff --git a/package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch b/package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch
> new file mode 100644
> index 0000000000..bf4d617fc1
> --- /dev/null
> +++ b/package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch
> @@ -0,0 +1,57 @@
> +From d3bb361eb0b6cbf0257f515f9d5e64add89e6bfa Mon Sep 17 00:00:00 2001
> +From: Romain Naour <romain.naour@gmail.com>
> +Date: Sun, 28 Aug 2022 23:21:37 +0200
> +Subject: [PATCH] gdb: Fix native build on xtensa
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Apply a similar fix than for Alpha architecture on gdb 9:
> +https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
> +
> +Fixes:
> +
> +../../gdb/xtensa-linux-nat.c: In function ‘void fill_gregset(const regcache*, elf_greg_t (*)[128], int)’:
> +../../gdb/xtensa-linux-nat.c:66:17: error: ‘gdbarch_pc_regnum’ was not declared in this scope
> +   66 |   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
> +      |                 ^~~~~~~~~~~~~~~~~
> +  CXX    complaints.o
> +../../gdb/xtensa-linux-nat.c:68:17: error: ‘gdbarch_ps_regnum’ was not declared in this scope
> +   68 |   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
> +      |                 ^~~~~~~~~~~~~~~~~
> +../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
> +   71 |   if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
> +      |                                      ^
> +In file included from ../../gdb/xtensa-linux-nat.c:38:
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘gdbarch_tdep::gdbarch_tdep()’
> +  160 | struct gdbarch_tdep
> +      |        ^~~~~~~~~~~~
> +../../gdb/xtensa-tdep.h:160:8: note:   candidate expects 0 arguments, 1 provided
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)’
> +../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘const gdbarch_tdep&’
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)’
> +../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘gdbarch_tdep&&’
> +../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
> +   72 |     regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
> +      |                                                 ^
> +
> +Signed-off-by: Romain Naour <romain.naour@gmail.com>
> +---
> + gdb/xtensa-linux-nat.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
> +index ec33f4a10f2..73f35eac683 100644
> +--- a/gdb/xtensa-linux-nat.c
> ++++ b/gdb/xtensa-linux-nat.c
> +@@ -36,6 +36,7 @@
> + 
> + #include "gregset.h"
> + #include "xtensa-tdep.h"
> ++#include "gdbarch.h"
> + 
> + /* Defines ps_err_e, struct ps_prochandle.  */
> + #include "gdb_proc_service.h"
> +-- 
> +2.37.2
> +
> diff --git a/package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch b/package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch
> new file mode 100644
> index 0000000000..4ff3828f2a
> --- /dev/null
> +++ b/package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch
> @@ -0,0 +1,57 @@
> +From 222cb32acf044fe90e8534b064f9168ad0d8c705 Mon Sep 17 00:00:00 2001
> +From: Romain Naour <romain.naour@gmail.com>
> +Date: Sun, 28 Aug 2022 23:21:37 +0200
> +Subject: [PATCH] gdb: Fix native build on xtensa
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Apply a similar fix than for Alpha architecture on gdb 9:
> +https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
> +
> +Fixes:
> +
> +../../gdb/xtensa-linux-nat.c: In function ‘void fill_gregset(const regcache*, elf_greg_t (*)[128], int)’:
> +../../gdb/xtensa-linux-nat.c:66:17: error: ‘gdbarch_pc_regnum’ was not declared in this scope
> +   66 |   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
> +      |                 ^~~~~~~~~~~~~~~~~
> +  CXX    complaints.o
> +../../gdb/xtensa-linux-nat.c:68:17: error: ‘gdbarch_ps_regnum’ was not declared in this scope
> +   68 |   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
> +      |                 ^~~~~~~~~~~~~~~~~
> +../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
> +   71 |   if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
> +      |                                      ^
> +In file included from ../../gdb/xtensa-linux-nat.c:38:
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘gdbarch_tdep::gdbarch_tdep()’
> +  160 | struct gdbarch_tdep
> +      |        ^~~~~~~~~~~~
> +../../gdb/xtensa-tdep.h:160:8: note:   candidate expects 0 arguments, 1 provided
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)’
> +../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘const gdbarch_tdep&’
> +../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)’
> +../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘gdbarch_tdep&&’
> +../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
> +   72 |     regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
> +      |                                                 ^
> +
> +Signed-off-by: Romain Naour <romain.naour@gmail.com>
> +---
> + gdb/xtensa-linux-nat.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
> +index 097d7bd6f96..4e4290fe038 100644
> +--- a/gdb/xtensa-linux-nat.c
> ++++ b/gdb/xtensa-linux-nat.c
> +@@ -36,6 +36,7 @@
> + 
> + #include "gregset.h"
> + #include "xtensa-tdep.h"
> ++#include "gdbarch.h"
> + 
> + /* Defines ps_err_e, struct ps_prochandle.  */
> + #include "gdb_proc_service.h"
> +-- 
> +2.37.2
> +
> -- 
> 2.37.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Romain Naour Sept. 6, 2022, 4:52 p.m. UTC | #2
Yann, All,

Le 06/09/2022 à 17:50, Yann E. MORIN a écrit :
> Romain, All,
> 
> On 2022-08-29 22:21 +0200, Romain Naour spake thusly:
>> It seems that gdb doesn't build for xtensa since a while, indeed commit
>> [1] merged in gdb 9 introduced a few number of build issues on several
>> architectures:
>>
>> [Fix gdb build on macOS]
>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b1c896b365f2dbcd14145a88d103623244cf0fb0
>>
>> [gdb: Fix gdb build on mips64-linux]
>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=2208ee917050bcc901c7faefdee257ffbf8ef2ab
>>
>> [gdb: Fix native build on Linux/Alpha.]
>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
>>
>> [Include gdbarch.h in m68k-linux-nat.c]
>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a7cdaa914f4b937544d8f102679bb5129bb1ef08
>>
>> [gdb: include gdbarch.h in hppa-linux-nat.c]
>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ad75efa628656716982f2674008952bfd2c268af
>>
>> Most of them has been fixed before the gdb 9 release but it seems
>> that xtensa is the last one on this list and still unfixed with
>> gdb 11 (not even noticed by Buildroot autobuilders).
>>
>> [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=0d12e84cfc9bd36b7bbda01a3c8f83f65a832398
>>
>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>> Cc: Max Filippov <jcmvbkbc@gmail.com>
> 
> Applied to master, thanks.
> 
>> ---
>> gcc 12 is also broken due to too old xtensa overlay for gdb:
>>
>> xtensa overlays form 2016 override gdb/xtensa-config.c breaking
>> the gdb 12 build due a recent changes from commit:
>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=345bd07cce33565f1cd66acabdaf387ca3a7ccb3
> 
> Should we mask out gdb-12 for xtensa in next, then?

gdb-12 for xtensa should build when no overlay is used.

It should be masked with the overlay we currently use...
I'm not sure what we really can do...

Best regards,
Romain


> 
> Regards,
> Yann E. MORIN.
>
Peter Korsgaard Sept. 18, 2022, 9:03 a.m. UTC | #3
>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > It seems that gdb doesn't build for xtensa since a while, indeed commit
 > [1] merged in gdb 9 introduced a few number of build issues on several
 > architectures:

 > [Fix gdb build on macOS]
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=b1c896b365f2dbcd14145a88d103623244cf0fb0

 > [gdb: Fix gdb build on mips64-linux]
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=2208ee917050bcc901c7faefdee257ffbf8ef2ab

 > [gdb: Fix native build on Linux/Alpha.]
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231

 > [Include gdbarch.h in m68k-linux-nat.c]
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a7cdaa914f4b937544d8f102679bb5129bb1ef08

 > [gdb: include gdbarch.h in hppa-linux-nat.c]
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ad75efa628656716982f2674008952bfd2c268af

 > Most of them has been fixed before the gdb 9 release but it seems
 > that xtensa is the last one on this list and still unfixed with
 > gdb 11 (not even noticed by Buildroot autobuilders).

 > [1]
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=0d12e84cfc9bd36b7bbda01a3c8f83f65a832398

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: Max Filippov <jcmvbkbc@gmail.com>
 > ---
 > gcc 12 is also broken due to too old xtensa overlay for gdb:

 > xtensa overlays form 2016 override gdb/xtensa-config.c breaking
 > the gdb 12 build due a recent changes from commit:
 > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=345bd07cce33565f1cd66acabdaf387ca3a7ccb3

Committed to 2022.05.x and 2022.02.x, thanks.
diff mbox series

Patch

diff --git a/package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch b/package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch
new file mode 100644
index 0000000000..927bf20de5
--- /dev/null
+++ b/package/gdb/10.2/0009-gdb-Fix-native-build-on-xtensa.patch
@@ -0,0 +1,57 @@ 
+From 02d9e6a3bc47dfe138ef4511aaeeae26b7dbd1ba Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 28 Aug 2022 23:21:37 +0200
+Subject: [PATCH] gdb: Fix native build on xtensa
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Apply a similar fix than for Alpha architecture on gdb 9:
+https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
+
+Fixes:
+
+../../gdb/xtensa-linux-nat.c: In function ‘void fill_gregset(const regcache*, elf_greg_t (*)[128], int)’:
+../../gdb/xtensa-linux-nat.c:66:17: error: ‘gdbarch_pc_regnum’ was not declared in this scope
+   66 |   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
+      |                 ^~~~~~~~~~~~~~~~~
+  CXX    complaints.o
+../../gdb/xtensa-linux-nat.c:68:17: error: ‘gdbarch_ps_regnum’ was not declared in this scope
+   68 |   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
+      |                 ^~~~~~~~~~~~~~~~~
+../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
+   71 |   if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
+      |                                      ^
+In file included from ../../gdb/xtensa-linux-nat.c:38:
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘gdbarch_tdep::gdbarch_tdep()’
+  160 | struct gdbarch_tdep
+      |        ^~~~~~~~~~~~
+../../gdb/xtensa-tdep.h:160:8: note:   candidate expects 0 arguments, 1 provided
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)’
+../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘const gdbarch_tdep&’
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)’
+../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘gdbarch_tdep&&’
+../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
+   72 |     regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
+      |                                                 ^
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ gdb/xtensa-linux-nat.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
+index b2b3db182bc..b230e08b69f 100644
+--- a/gdb/xtensa-linux-nat.c
++++ b/gdb/xtensa-linux-nat.c
+@@ -36,6 +36,7 @@
+ 
+ #include "gregset.h"
+ #include "xtensa-tdep.h"
++#include "gdbarch.h"
+ 
+ /* Defines ps_err_e, struct ps_prochandle.  */
+ #include "gdb_proc_service.h"
+-- 
+2.37.2
+
diff --git a/package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch b/package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch
new file mode 100644
index 0000000000..bf4d617fc1
--- /dev/null
+++ b/package/gdb/11.2/0009-gdb-Fix-native-build-on-xtensa.patch
@@ -0,0 +1,57 @@ 
+From d3bb361eb0b6cbf0257f515f9d5e64add89e6bfa Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 28 Aug 2022 23:21:37 +0200
+Subject: [PATCH] gdb: Fix native build on xtensa
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Apply a similar fix than for Alpha architecture on gdb 9:
+https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
+
+Fixes:
+
+../../gdb/xtensa-linux-nat.c: In function ‘void fill_gregset(const regcache*, elf_greg_t (*)[128], int)’:
+../../gdb/xtensa-linux-nat.c:66:17: error: ‘gdbarch_pc_regnum’ was not declared in this scope
+   66 |   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
+      |                 ^~~~~~~~~~~~~~~~~
+  CXX    complaints.o
+../../gdb/xtensa-linux-nat.c:68:17: error: ‘gdbarch_ps_regnum’ was not declared in this scope
+   68 |   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
+      |                 ^~~~~~~~~~~~~~~~~
+../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
+   71 |   if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
+      |                                      ^
+In file included from ../../gdb/xtensa-linux-nat.c:38:
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘gdbarch_tdep::gdbarch_tdep()’
+  160 | struct gdbarch_tdep
+      |        ^~~~~~~~~~~~
+../../gdb/xtensa-tdep.h:160:8: note:   candidate expects 0 arguments, 1 provided
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)’
+../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘const gdbarch_tdep&’
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)’
+../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘gdbarch_tdep&&’
+../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
+   72 |     regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
+      |                                                 ^
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ gdb/xtensa-linux-nat.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
+index ec33f4a10f2..73f35eac683 100644
+--- a/gdb/xtensa-linux-nat.c
++++ b/gdb/xtensa-linux-nat.c
+@@ -36,6 +36,7 @@
+ 
+ #include "gregset.h"
+ #include "xtensa-tdep.h"
++#include "gdbarch.h"
+ 
+ /* Defines ps_err_e, struct ps_prochandle.  */
+ #include "gdb_proc_service.h"
+-- 
+2.37.2
+
diff --git a/package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch b/package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch
new file mode 100644
index 0000000000..4ff3828f2a
--- /dev/null
+++ b/package/gdb/9.2/0009-gdb-Fix-native-build-on-xtensa.patch
@@ -0,0 +1,57 @@ 
+From 222cb32acf044fe90e8534b064f9168ad0d8c705 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 28 Aug 2022 23:21:37 +0200
+Subject: [PATCH] gdb: Fix native build on xtensa
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Apply a similar fix than for Alpha architecture on gdb 9:
+https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
+
+Fixes:
+
+../../gdb/xtensa-linux-nat.c: In function ‘void fill_gregset(const regcache*, elf_greg_t (*)[128], int)’:
+../../gdb/xtensa-linux-nat.c:66:17: error: ‘gdbarch_pc_regnum’ was not declared in this scope
+   66 |   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
+      |                 ^~~~~~~~~~~~~~~~~
+  CXX    complaints.o
+../../gdb/xtensa-linux-nat.c:68:17: error: ‘gdbarch_ps_regnum’ was not declared in this scope
+   68 |   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
+      |                 ^~~~~~~~~~~~~~~~~
+../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
+   71 |   if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
+      |                                      ^
+In file included from ../../gdb/xtensa-linux-nat.c:38:
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘gdbarch_tdep::gdbarch_tdep()’
+  160 | struct gdbarch_tdep
+      |        ^~~~~~~~~~~~
+../../gdb/xtensa-tdep.h:160:8: note:   candidate expects 0 arguments, 1 provided
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)’
+../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘const gdbarch_tdep&’
+../../gdb/xtensa-tdep.h:160:8: note: candidate: ‘constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)’
+../../gdb/xtensa-tdep.h:160:8: note:   no known conversion for argument 1 from ‘gdbarch*’ to ‘gdbarch_tdep&&’
+../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to ‘gdbarch_tdep::gdbarch_tdep(gdbarch*&)’
+   72 |     regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
+      |                                                 ^
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ gdb/xtensa-linux-nat.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
+index 097d7bd6f96..4e4290fe038 100644
+--- a/gdb/xtensa-linux-nat.c
++++ b/gdb/xtensa-linux-nat.c
+@@ -36,6 +36,7 @@
+ 
+ #include "gregset.h"
+ #include "xtensa-tdep.h"
++#include "gdbarch.h"
+ 
+ /* Defines ps_err_e, struct ps_prochandle.  */
+ #include "gdb_proc_service.h"
+-- 
+2.37.2
+