X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Famd64-tdep.c;h=b95ab1e87b81db582768ca5696d588988f6730d1;hb=ea764154c27a11619ba764a4c92f395ba5007234;hp=7c67359678b8684855ce1fc4f1c19cf5362e07db;hpb=345bd07cce33565f1cd66acabdaf387ca3a7ccb3;p=binutils-gdb.git diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 7c67359678b..b95ab1e87b8 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for AMD64. - Copyright (C) 2001-2021 Free Software Foundation, Inc. + Copyright (C) 2001-2022 Free Software Foundation, Inc. Contributed by Jiri Smid, SuSE Labs. @@ -656,9 +656,19 @@ amd64_classify_aggregate_field (struct type *type, int i, static void amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2]) { - /* 1. If the size of an object is larger than two eightbytes, or it has - unaligned fields, it has class memory. */ - if (TYPE_LENGTH (type) > 16 || amd64_has_unaligned_fields (type)) + /* 1. If the size of an object is larger than two times eight bytes, or + it is a non-trivial C++ object, or it has unaligned fields, then it + has class memory. + + It is important that the trivially_copyable check is before the + unaligned fields check, as C++ classes with virtual base classes + will have fields (for the virtual base classes) with non-constant + loc_bitpos attributes, which will cause an assert to trigger within + the unaligned field check. As classes with virtual bases are not + trivially copyable, checking that first avoids this problem. */ + if (TYPE_LENGTH (type) > 16 + || !language_pass_by_reference (type).trivially_copyable + || amd64_has_unaligned_fields (type)) { theclass[0] = theclass[1] = AMD64_MEMORY; return; @@ -2464,8 +2474,8 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc) start_pc_sal = find_pc_sect_line (start_pc, NULL, 0); if (start_pc_sal.symtab == NULL - || producer_is_gcc_ge_4 (COMPUNIT_PRODUCER - (SYMTAB_COMPUNIT (start_pc_sal.symtab))) < 6 + || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit () + ->producer ()) < 6 || start_pc_sal.pc != start_pc || pc >= start_pc_sal.end) return pc; @@ -2535,9 +2545,9 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) compilers to emit usable line notes. */ if (post_prologue_pc && (cust != NULL - && COMPUNIT_PRODUCER (cust) != NULL - && (producer_is_llvm (COMPUNIT_PRODUCER (cust)) - || producer_is_icc_ge_19 (COMPUNIT_PRODUCER (cust))))) + && cust->producer () != nullptr + && (producer_is_llvm (cust->producer ()) + || producer_is_icc_ge_19 (cust->producer ())))) return std::max (start_pc, post_prologue_pc); } @@ -2891,7 +2901,7 @@ amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) struct compunit_symtab *cust; cust = find_pc_compunit_symtab (pc); - if (cust != NULL && COMPUNIT_EPILOGUE_UNWIND_VALID (cust)) + if (cust != NULL && cust->epilogue_unwind_valid ()) return 0; if (target_read_memory (pc, &insn, 1))