add missing gcc_target_options method for nios2
Commit Message
While looking at gdb.compile test failures on nios2, I found that it was
passing an invalid option to gcc, due to another missing target method.
This patch doesn't make the "compile" command work for me yet (see PRs
23671 and 23672 that I filed last night) but it seems like something
that will be necessary to get there. OK to commit?
-Sandra
Comments
>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:
Sandra> While looking at gdb.compile test failures on nios2, I found that it
Sandra> was passing an invalid option to gcc, due to another missing target
Sandra> method. This patch doesn't make the "compile" command work for me yet
Sandra> (see PRs 23671 and 23672 that I filed last night) but it seems like
Sandra> something that will be necessary to get there. OK to commit?
Sandra> -Sandra
Sandra> commit fce4579114f47246773caa9c68969a90794ff90d
Sandra> Author: Sandra Loosemore <sandra@codesourcery.com>
Sandra> Date: Sun Sep 16 14:35:43 2018 -0700
Sandra> Add gcc_target_options hook for nios2.
Sandra> 2018-09-16 Sandra Loosemore <sandra@codesourcery.com>
Sandra> gdb/
Sandra> * nios2-tdep.c (nios2_gcc_target_options): New.
Sandra> (nios2_gdb_arch_init): Install new hook.
Thank you. This is ok.
The default gcc_target_options seems overly specific to me.
Tom
On 09/18/2018 01:15 PM, Tom Tromey wrote:
>>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:
>
> Sandra> While looking at gdb.compile test failures on nios2, I found that it
> Sandra> was passing an invalid option to gcc, due to another missing target
> Sandra> method. This patch doesn't make the "compile" command work for me yet
> Sandra> (see PRs 23671 and 23672 that I filed last night) but it seems like
> Sandra> something that will be necessary to get there. OK to commit?
>
> Sandra> -Sandra
>
> Sandra> commit fce4579114f47246773caa9c68969a90794ff90d
> Sandra> Author: Sandra Loosemore <sandra@codesourcery.com>
> Sandra> Date: Sun Sep 16 14:35:43 2018 -0700
>
> Sandra> Add gcc_target_options hook for nios2.
>
> Sandra> 2018-09-16 Sandra Loosemore <sandra@codesourcery.com>
>
> Sandra> gdb/
> Sandra> * nios2-tdep.c (nios2_gcc_target_options): New.
> Sandra> (nios2_gdb_arch_init): Install new hook.
>
> Thank you. This is ok.
>
> The default gcc_target_options seems overly specific to me.
Me too. Based on reading the code, I've gotten the impression that the
compile functionality in GDB has not been well-tested on any target
other than native x86 GNU/Linux and some of the design/implementation
decisions reflect that.
-Sandra
commit fce4579114f47246773caa9c68969a90794ff90d
Author: Sandra Loosemore <sandra@codesourcery.com>
Date: Sun Sep 16 14:35:43 2018 -0700
Add gcc_target_options hook for nios2.
2018-09-16 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (nios2_gcc_target_options): New.
(nios2_gdb_arch_init): Install new hook.
@@ -1,3 +1,8 @@
+2018-09-16 Sandra Loosemore <sandra@codesourcery.com>
+
+ * nios2-tdep.c (nios2_gcc_target_options): New.
+ (nios2_gdb_arch_init): Install new hook.
+
2018-09-16 Tom Tromey <tom@tromey.com>
* python/python-internal.h (CPYCHECKER_RETURNS_BORROWED_REF):
@@ -2239,6 +2239,14 @@ nios2_type_align (struct gdbarch *gdbarch, struct type *type)
return std::min<ULONGEST> (4, TYPE_LENGTH (type));
}
+/* Implement the gcc_target_options gdbarch method. */
+static char *
+nios2_gcc_target_options (struct gdbarch *gdbarch)
+{
+ /* GCC doesn't know "-m32". */
+ return NULL;
+}
+
/* Initialize the Nios II gdbarch. */
static struct gdbarch *
@@ -2344,6 +2352,9 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Single stepping. */
set_gdbarch_software_single_step (gdbarch, nios2_software_single_step);
+ /* Target options for compile. */
+ set_gdbarch_gcc_target_options (gdbarch, nios2_gcc_target_options);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);