producer_is_icc_lt_14 (false),
producer_is_codewarrior (false),
producer_is_clang (false),
+ producer_is_gas_2_39 (false),
processing_has_namespace_info (false),
load_all_dies (false)
{
bool producer_is_icc_lt_14 : 1;
bool producer_is_codewarrior : 1;
bool producer_is_clang : 1;
+ bool producer_is_gas_2_39 : 1;
/* When true, the file that we're processing is known to have
debugging info for C++ namespaces. GCC 3.3.x did not produce
cu->producer_is_codewarrior = true;
else if (producer_is_clang (cu->producer, &major, &minor))
cu->producer_is_clang = true;
+ else if (startswith (cu->producer, "GNU AS 2.39.0"))
+ cu->producer_is_gas_2_39 = true;
else
{
/* For other non-GCC compilers, expect their behavior is DWARF version
return cu->producer_is_codewarrior;
}
+static bool
+producer_is_gas_2_39 (struct dwarf2_cu *cu)
+{
+ if (!cu->checked_producer)
+ check_producer (cu);
+
+ return cu->producer_is_gas_2_39;
+}
+
/* Return the accessibility of DIE, as given by DW_AT_accessibility.
If that attribute is not available, return the appropriate
default. */
type = die_type (die, cu);
+ if (type->code () == TYPE_CODE_VOID
+ && !type->is_stub ()
+ && die->child == nullptr
+ && producer_is_gas_2_39 (cu))
+ {
+ /* Work around PR gas/29517, pretend we have an DW_TAG_unspecified_type
+ return type. */
+ type = (type_allocator (cu->per_objfile->objfile, cu->lang ())
+ .new_type (TYPE_CODE_VOID, 0, nullptr));
+ type->set_is_stub (true);
+ }
+
/* The die_type call above may have already set the type for this DIE. */
ftype = get_die_type (die, cu);
if (ftype)
if (minor == NULL)
minor = &min;
+ /* Skip GNU. */
+ cs = &producer[strlen ("GNU ")];
+
+ /* Bail out for GNU AS. */
+ if (startswith (cs, "AS "))
+ return 0;
+
/* Skip any identifier after "GNU " - such as "C11" "C++" or "Java".
A full producer string might look like:
"GNU C 4.7.2"
"GNU Fortran 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic ..."
"GNU C++14 5.0.0 20150123 (experimental)"
*/
- cs = &producer[strlen ("GNU ")];
while (*cs && !isspace (*cs))
cs++;
if (*cs && isspace (*cs))
extern int foo (void);
+int
+bar (void)
+{
+ asm ("bar_label: .globl bar_label");
+ return 0;
+}
+
int
main (void)
{
- int res = foo ();
+ int res = foo () + bar ();
return res;
}
foo_start foo_len
set foo_end "$foo_start + $foo_len"
+set bar_res \
+ [function_range bar \
+ [list ${srcdir}/${subdir}/$srcfile ${srcdir}/${subdir}/$srcfile2]]
+lassign $bar_res \
+ bar_start bar_len
+set bar_end "$bar_start + $bar_len"
+
# Create the DWARF.
set asm_file [standard_output_file $srcfile3]
Dwarf::assemble $asm_file {
global foo_start foo_end
+ global bar_start bar_end
declare_labels unspecified_type_label
cu {} {
{high_pc $foo_end addr}
{type :$unspecified_type_label}
}
+ }
+ }
+ cu {} {
+ compile_unit {
+ {language @DW_LANG_Mips_Assembler}
+ {producer "GNU AS 2.39.0"}
+ } {
+ DW_TAG_subprogram {
+ {name bar}
+ {low_pc $bar_start addr}
+ {high_pc $bar_end addr}
+ }
}
}
}
return -1
}
-# Print the function type. Return type should be stub type, which is printed
-# as void.
-gdb_test "ptype foo" "type = void \\(void\\)"
+foreach f {foo bar} {
+ # Print the function type. Return type should be stub type, which is printed
+ # as void.
+ gdb_test "ptype $f" "type = void \\(void\\)"
-# Call the function, casting the function to the correct function type.
-gdb_test "p ((int (*) ()) foo) ()" " = 0"
+ # Call the function, casting the function to the correct function type.
+ gdb_test "p ((int (*) ()) $f) ()" " = 0"
-# Call the function, casting the function result to the correct type.
-gdb_test "p (int) foo ()" " = 0"
+ # Call the function, casting the function result to the correct type.
+ gdb_test "p (int) $f ()" " = 0"
+}