* [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
@ 2013-08-12 19:47 Sergio Durigan Junior
2013-08-12 21:19 ` Joern Rennecke
0 siblings, 1 reply; 8+ messages in thread
From: Sergio Durigan Junior @ 2013-08-12 19:47 UTC (permalink / raw)
To: GDB Patches; +Cc: Pedro Alves, Joern Rennecke
Hi,
Given the discussion on:
<http://sourceware.org/ml/gdb-patches/2013-08/msg00290.html>
<http://sourceware.org/ml/gdb-patches/2013-08/msg00296.html>
Here is the patch to add avr-linux-tdep.c. This patch also reimplements
gdbarch_gdb_signal_{to,from}_target for AVR targets running on Linux.
Joern, could you please give it a try (I don't have access to AVR
targets here), and tell me what you think?
Thanks,
--
Sergio
2013-08-12 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (ALL_TARGET_OBS): Add avr-linux-tdep.o.
(ALLDEPFILES): Add avr-linux-tdep.c.
* avr-linux-tdep.c: New file.
* configure.tgt: Add match for avr-*-*linux*.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 9171940..0be4198 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -548,7 +548,7 @@ ALL_TARGET_OBS = \
armbsd-tdep.o arm-linux-tdep.o arm-symbian-tdep.o \
armnbsd-tdep.o armobsd-tdep.o \
arm-tdep.o arm-wince-tdep.o \
- avr-tdep.o \
+ avr-linux-tdep.o avr-tdep.o \
bfin-linux-tdep.o bfin-tdep.o \
cris-tdep.o \
dicos-tdep.o \
@@ -1473,7 +1473,7 @@ ALLDEPFILES = \
amd64-sol2-tdep.c \
arm-linux-nat.c arm-linux-tdep.c arm-symbian-tdep.c arm-tdep.c \
armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \
- avr-tdep.c \
+ avr-linux-tdep.c avr-tdep.c \
bfin-linux-tdep.c bfin-tdep.c \
bsd-uthread.c bsd-kvm.c \
core-regset.c \
diff --git a/gdb/avr-linux-tdep.c b/gdb/avr-linux-tdep.c
new file mode 100644
index 0000000..e45ddb7
--- /dev/null
+++ b/gdb/avr-linux-tdep.c
@@ -0,0 +1,115 @@
+/* Target-dependent code for Atmel AVR, for GDB.
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "gdbarch.h"
+#include "osabi.h"
+#include "linux-tdep.h"
+
+/* This enum represents the signals' numbers on the AVR
+ architecture. It just contains the signal definitions which are
+ different from the generic implementation.
+
+ It is derived from the file <arch/avr32/include/uapi/asm/signal.h>,
+ from the Linux kernel tree. */
+
+enum
+ {
+ AVR_LINUX_SIGRTMIN = 32,
+ AVR_LINUX_SIGRTMAX = 63,
+ };
+
+/* Implementation of `gdbarch_gdb_signal_from_target', as defined in
+ gdbarch.h. */
+
+static enum gdb_signal
+avr_linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
+{
+ if (signal >= AVR_LINUX_SIGRTMIN && signal <= AVR_LINUX_SIGRTMAX)
+ {
+ int offset = signal - AVR_LINUX_SIGRTMIN;
+
+ if (offset == 0)
+ return GDB_SIGNAL_REALTIME_32;
+ else
+ return (enum gdb_signal) (offset - 1
+ + (int) GDB_SIGNAL_REALTIME_33);
+ }
+ else if (signal > AVR_LINUX_SIGRTMAX)
+ return GDB_SIGNAL_UNKNOWN;
+
+ return linux_gdb_signal_from_target (gdbarch, signal);
+}
+
+/* Implementation of `gdbarch_gdb_signal_to_target', as defined in
+ gdbarch.h. */
+
+static int
+avr_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
+ enum gdb_signal signal)
+{
+ switch (signal)
+ {
+ /* GDB_SIGNAL_REALTIME_32 is not continuous in <gdb/signals.def>,
+ therefore we have to handle it here. */
+ case GDB_SIGNAL_REALTIME_32:
+ return AVR_LINUX_SIGRTMIN;
+
+ /* GDB_SIGNAL_REALTIME_64 is not valid on AVR. */
+ case GDB_SIGNAL_REALTIME_64:
+ return -1;
+ }
+
+ /* GDB_SIGNAL_REALTIME_33 to _63 are continuous.
+ AVR does not have _64. */
+ if (signal >= GDB_SIGNAL_REALTIME_33
+ && signal <= GDB_SIGNAL_REALTIME_63)
+ {
+ int offset = signal - GDB_SIGNAL_REALTIME_33;
+
+ return AVR_LINUX_SIGRTMIN + 1 + offset;
+ }
+
+ return linux_gdb_signal_to_target (gdbarch, signal);
+}
+
+\f
+
+/* Initialize ABI for AVR. */
+
+static void
+avr_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ linux_init_abi (info, gdbarch);
+
+ set_gdbarch_gdb_signal_from_target (gdbarch,
+ avr_linux_gdb_signal_from_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch,
+ avr_linux_gdb_signal_to_target);
+}
+
+/* Silence -Wmissing-prototypes. */
+extern initialize_file_ftype _initialize_avr_linux_tdep;
+
+void
+_initialize_avr_linux_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_avr, 0, GDB_OSABI_LINUX,
+ avr_linux_init_abi);
+}
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 653ba2b..500c596 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -111,6 +111,12 @@ arm*-*-*)
gdb_sim=../sim/arm/libsim.a
;;
+avr-*-*linux*)
+ # Target: AVR Linux
+ gdb_target_obs="avr-tdep.o avr-linux-tdep.o linux-tdep.o"
+ gdb_sim=../sim/avr/libsim.a
+ ;;
+
avr-*-*)
# Target: AVR
gdb_target_obs="avr-tdep.o"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-12 19:47 [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target) Sergio Durigan Junior
@ 2013-08-12 21:19 ` Joern Rennecke
2013-08-12 21:49 ` Sergio Durigan Junior
0 siblings, 1 reply; 8+ messages in thread
From: Joern Rennecke @ 2013-08-12 21:19 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: GDB Patches, Pedro Alves
Quoting Sergio Durigan Junior <sergiodj@redhat.com>:
> +avr-*-*linux*)
> + # Target: AVR Linux
> + gdb_target_obs="avr-tdep.o avr-linux-tdep.o linux-tdep.o"
> + gdb_sim=../sim/avr/libsim.a
> + ;;
> +
> avr-*-*)
> # Target: AVR
> gdb_target_obs="avr-tdep.o"
>
That is creating a new target. So are users using a linux host supposed
to configure for this new target? But why does it look like it's the
target that is running linux - there is no such thing for avr.
Shouldn't we rather autoconf the host signals?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-12 21:19 ` Joern Rennecke
@ 2013-08-12 21:49 ` Sergio Durigan Junior
2013-08-13 14:16 ` Pedro Alves
2013-08-25 4:51 ` Mike Frysinger
0 siblings, 2 replies; 8+ messages in thread
From: Sergio Durigan Junior @ 2013-08-12 21:49 UTC (permalink / raw)
To: Joern Rennecke; +Cc: GDB Patches, Pedro Alves
On Monday, August 12 2013, Joern Rennecke wrote:
> Quoting Sergio Durigan Junior <sergiodj@redhat.com>:
>
>
>> +avr-*-*linux*)
>> + # Target: AVR Linux
>> + gdb_target_obs="avr-tdep.o avr-linux-tdep.o linux-tdep.o"
>> + gdb_sim=../sim/avr/libsim.a
>> + ;;
>> +
>> avr-*-*)
>> # Target: AVR
>> gdb_target_obs="avr-tdep.o"
>>
>
> That is creating a new target.
Yes.
> So are users using a linux host supposed
> to configure for this new target? But why does it look like it's the
> target that is running linux - there is no such thing for avr.
> Shouldn't we rather autoconf the host signals?
These are not host signals, they are the target's.
Maybe I am confusing things here. I saw
<arch/avr32/include/uapi/asm/signal.h> and I assumed one could run Linux
on AVR, but on a further investigation I saw that it only applies to
AVR32, right? I'm definitely not an expert here, sorry about it.
But well, if that is the case, then I guess we can either (a) treat
AVR32 separately and make an avr32-linux-tdep.c for it, or (b) drop this
patch entirely.
WDYT? Am I missing something here?
--
Sergio
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-12 21:49 ` Sergio Durigan Junior
@ 2013-08-13 14:16 ` Pedro Alves
2013-08-13 16:00 ` Sergio Durigan Junior
2013-08-25 4:51 ` Mike Frysinger
1 sibling, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2013-08-13 14:16 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: Joern Rennecke, GDB Patches
On 08/12/2013 10:48 PM, Sergio Durigan Junior wrote:
> On Monday, August 12 2013, Joern Rennecke wrote:
>
>> Quoting Sergio Durigan Junior <sergiodj@redhat.com>:
>>
>>
>>> +avr-*-*linux*)
>>> + # Target: AVR Linux
>>> + gdb_target_obs="avr-tdep.o avr-linux-tdep.o linux-tdep.o"
>>> + gdb_sim=../sim/avr/libsim.a
>>> + ;;
>>> +
>>> avr-*-*)
>>> # Target: AVR
>>> gdb_target_obs="avr-tdep.o"
>>>
>>
>> That is creating a new target.
>
> Yes.
>
>> So are users using a linux host supposed
>> to configure for this new target? But why does it look like it's the
>> target that is running linux - there is no such thing for avr.
>> Shouldn't we rather autoconf the host signals?
>
> These are not host signals, they are the target's.
>
> Maybe I am confusing things here. I saw
> <arch/avr32/include/uapi/asm/signal.h> and I assumed one could run Linux
> on AVR, but on a further investigation I saw that it only applies to
> AVR32, right? I'm definitely not an expert here, sorry about it.
>
> But well, if that is the case, then I guess we can either (a) treat
> AVR32 separately and make an avr32-linux-tdep.c for it, or (b) drop this
> patch entirely.
Looks like upstream GDB doesn't support AVR32 at all. At least, I
can't find any hit for avr32 in the sources. I looked around, and
I can't find GDB in Atmel's current toolchains (on their site). I found
avr32-gdb-6.7.1.atmel.1.0.4.tar.gz at
http://distribute.atmel.no/tools/avr32/old/avr32gnutoolchain/v2.2.1/source/
though (note "old"), which does contain AVR32 GDB and GDBserver ports.
Guess this was never pushed upstream. Sounds like we should drop
this patch then.
--
Pedro Alves
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-13 14:16 ` Pedro Alves
@ 2013-08-13 16:00 ` Sergio Durigan Junior
0 siblings, 0 replies; 8+ messages in thread
From: Sergio Durigan Junior @ 2013-08-13 16:00 UTC (permalink / raw)
To: Pedro Alves; +Cc: Joern Rennecke, GDB Patches
On Tuesday, August 13 2013, Pedro Alves wrote:
> Looks like upstream GDB doesn't support AVR32 at all. At least, I
> can't find any hit for avr32 in the sources. I looked around, and
> I can't find GDB in Atmel's current toolchains (on their site). I found
> avr32-gdb-6.7.1.atmel.1.0.4.tar.gz at
> http://distribute.atmel.no/tools/avr32/old/avr32gnutoolchain/v2.2.1/source/
> though (note "old"), which does contain AVR32 GDB and GDBserver ports.
> Guess this was never pushed upstream. Sounds like we should drop
> this patch then.
Thanks, Pedro. Then consider the patch dropped.
--
Sergio
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-12 21:49 ` Sergio Durigan Junior
2013-08-13 14:16 ` Pedro Alves
@ 2013-08-25 4:51 ` Mike Frysinger
2013-08-25 19:42 ` Sergio Durigan Junior
1 sibling, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2013-08-25 4:51 UTC (permalink / raw)
To: gdb-patches; +Cc: Sergio Durigan Junior, Joern Rennecke, Pedro Alves
[-- Attachment #1: Type: Text/Plain, Size: 418 bytes --]
On Monday 12 August 2013 17:48:57 Sergio Durigan Junior wrote:
> Maybe I am confusing things here. I saw
> <arch/avr32/include/uapi/asm/signal.h> and I assumed one could run Linux
> on AVR, but on a further investigation I saw that it only applies to
> AVR32, right? I'm definitely not an expert here, sorry about it.
correct, the Linux/AVR32 port is only AVR32 and not general AVR
microcontrollers
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-25 4:51 ` Mike Frysinger
@ 2013-08-25 19:42 ` Sergio Durigan Junior
2013-08-26 3:41 ` Mike Frysinger
0 siblings, 1 reply; 8+ messages in thread
From: Sergio Durigan Junior @ 2013-08-25 19:42 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches, Joern Rennecke, Pedro Alves
On Sunday, August 25 2013, Mike Frysinger wrote:
> On Monday 12 August 2013 17:48:57 Sergio Durigan Junior wrote:
>> Maybe I am confusing things here. I saw
>> <arch/avr32/include/uapi/asm/signal.h> and I assumed one could run Linux
>> on AVR, but on a further investigation I saw that it only applies to
>> AVR32, right? I'm definitely not an expert here, sorry about it.
>
> correct, the Linux/AVR32 port is only AVR32 and not general AVR
> microcontrollers
Thanks for the correction. So it would not be wrong to create an
avr-*-linux target, right?
--
Sergio
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target)
2013-08-25 19:42 ` Sergio Durigan Junior
@ 2013-08-26 3:41 ` Mike Frysinger
0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2013-08-26 3:41 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: gdb-patches, Joern Rennecke, Pedro Alves
[-- Attachment #1: Type: Text/Plain, Size: 739 bytes --]
On Sunday 25 August 2013 15:42:01 Sergio Durigan Junior wrote:
> On Sunday, August 25 2013, Mike Frysinger wrote:
> > On Monday 12 August 2013 17:48:57 Sergio Durigan Junior wrote:
> >> Maybe I am confusing things here. I saw
> >> <arch/avr32/include/uapi/asm/signal.h> and I assumed one could run Linux
> >> on AVR, but on a further investigation I saw that it only applies to
> >> AVR32, right? I'm definitely not an expert here, sorry about it.
> >
> > correct, the Linux/AVR32 port is only AVR32 and not general AVR
> > microcontrollers
>
> Thanks for the correction. So it would not be wrong to create an
> avr-*-linux target, right?
pretty sure the avr32 guys use avr32-linux-{gnu,uclibc} as their tuples
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-26 3:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-12 19:47 [PATCH] Create avr-linux-tdep.c (add reintroduce gdbarch_gdb_signal_{to,from}_target for that target) Sergio Durigan Junior
2013-08-12 21:19 ` Joern Rennecke
2013-08-12 21:49 ` Sergio Durigan Junior
2013-08-13 14:16 ` Pedro Alves
2013-08-13 16:00 ` Sergio Durigan Junior
2013-08-25 4:51 ` Mike Frysinger
2013-08-25 19:42 ` Sergio Durigan Junior
2013-08-26 3:41 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox