1. May 04, 2021
    • Jim Wilson's avatar
      RISC-V: PR27764, Add tests for A extension · 7b06fcf5
      Jim Wilson authored
      ChangeLog entry for last patch.
      7b06fcf5
    • Christoph Muellner's avatar
      RISC-V: PR27764, Add tests for A extension · 6bdf164f
      Christoph Muellner authored
      
      
      gas/
          PR 27764
          * testsuite/gas/riscv/a-ext-64.d: New testcase.
          * testsuite/gas/riscv/a-ext-64.s: Likewise.
          * testsuite/gas/riscv/a-ext.d: Likewise.
          * testsuite/gas/riscv/a-ext.s: Likewise.
      
      Signed-off-by: default avatarChristoph Muellner <cmuellner@gcc.gnu.org>
      6bdf164f
    • Tom Tromey's avatar
      Fix x86_64 mingw build · 82288339
      Tom Tromey authored
      PR build/27807 points out that my recent changes to the Windows port
      missed a spot in win32-i386-low.cc -- a call to
      win32_Wow64GetThreadContext remained, causing link errors in
      gdbserver.  This happened because I tested an i686 build, but this
      code is only used on an x86_64 build.
      
      This patch fixes the bug.  I am checking it in.
      
      gdbserver/ChangeLog
      2021-05-03  Tom Tromey  <tromey@adacore.com>
      
      	PR build/27807:
      	* win32-i386-low.cc (i386_get_thread_context): Call
      	Wow64GetThreadContext, not win32_Wow64GetThreadContext.
      82288339
  2. May 03, 2021
    • Simon Marchi's avatar
      sim: add ATTRIBUTE_PRINTF / ATTRIBUTE_NULL_PRINTF where necessary · f08708cb
      Simon Marchi authored
      I finally got the all-targets sim building with Clang, these are all the
      instances where an ATTRIBUTE_PRINTF or ATTRIBUTE_NULL_PRINTF attribute
      needed to be added to avoid errors like:
      
          /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-profile.c:464:19: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
              vfprintf (fp, fmt, ap);
                            ^~~
      There are more fixes needed to get everything building, but adding these
      attributes is trivial enough, so I send them all in a single patch.
      
      Adding the format attributes introduces some format string errors when
      building with GCC (because now format strings are checked), so
      corresponding changes are needed to avoid breaking the build.  Other
      than simple format string specified changes, there is this one:
      
          /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c: In function 'hw_event_queue_schedule':
          /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c:95:15: error: too many arguments for format [-Werror=format-extra-args]
             95 |         NULL, dummy);
                |               ^~~~~
      
      We can fix it and avoid using a dummy variable by simply calling
      hw_event_queue_schedule_tracef instead of
      hw_event_queue_schedule_vtracef.
      
      sim/arm/ChangeLog:
      
      	* armdefs.h (ARMul_ConsolePrint): Use format attribute.
      	* wrapper.c (op_printf): Likewise.
      
      sim/bfin/ChangeLog:
      
      	* interp.c (sim_open): Adjust format string specifier.
      
      sim/common/ChangeLog:
      
      	* hw-events.h (hw_event_queue_schedule_tracef): Use format attribute.
      	(hw_event_queue_schedule_vtracef): Likewise.
      	* hw-tree.h (hw_tree_vparse): Likewise.
      	* sim-profile.c (profile_vprintf): Likewise.
      	* sim-trace.c (dis_printf): Likewise.
      	* sim-trace.h (trace_printf): Likewise.
      	(trace_vprintf): Likewise.
      	* sim-utils.h (sim_do_commandf): Likewise.
      	* hw-events.c (hw_event_queue_schedule): Use
      	hw_event_queue_schedule_tracef.
      
      sim/rx/ChangeLog:
      
      	* trace.c (op_printf): Likewise.
      
      sim/v850/ChangeLog:
      
      	* interp.c (sim_open): Adjust format string specifier.
      
      Change-Id: I1445115ce57db15bb8e35dca93014555e7555794
      f08708cb
    • Jan Beulich's avatar
      x86: allow @secrel32 also in data definitions · 5e0a033b
      Jan Beulich authored
      Now that lex_got() is uniform for all targets using it, permit COFF
      targets to also use @secrel32 with, in particular, .long. This is more
      natural than the custom .secrel32 directive, and also allows more
      flexibility (the "+six" form of the two added test lines doesn't work
      with a .secrel32 equivalent, in that it silently produces an unintended
      relocation type).
      
      As an extra benefit this also makes sure that data definitions in Intel
      syntax mode would get treated like they do for e.g. ELF targets.
      5e0a033b
    • Jan Beulich's avatar
      x86: use UNIX EOL in secrel testcase · 3e301ce0
      Jan Beulich authored
      For some reason these were using Windows EOL.
      3e301ce0
    • Jan Beulich's avatar
      x86: fold both instances of lex_got() · deea4973
      Jan Beulich authored
      I see no reason at all for us to carry two copies of almost identical
      code. The differences, apart from the table entries, are benign. And
      the #ifdef-ary doesn't really get any worse.
      deea4973
    • Jan Beulich's avatar
      x86: don't request useless overflow checking · 4c398cc0
      Jan Beulich authored
      Relocations with a bitsize matching the architecture's address width
      can't usefully use an overflow checking approach other than "dont" or
      "signed": All others involve perhaps complex calculations in
      _bfd_relocate_contents() (or, not as severe, in bfd_check_overflow())
      without ever finding anything to complain about - because of the address
      width masking applied. Avoid this unnecessary overhead and switch all
      such reloc types to "dont".
      
      Note that "signed" checking with rela relocations (i.e. x86-64 here) is
      only going to be useful if the addend actually got passed to
      _bfd_relocate_contents() (and maybe others) instead of bogusly adding in
      prior section contents (which apparently is assumed to be zero, and
      hence again no overflow would ever be detected). See
      https://sourceware.org/pipermail/binutils/2021-April/116164.html.
      4c398cc0
    • Andrew Burgess's avatar
      gdb/testsuite: update expected results in gdb.python/py-startup-opt.exp · d389a1a7
      Andrew Burgess authored
      The test gdb.python/py-startup-opt.exp checks the behaviour of GDB's:
      
        set python dont-write-bytecode on
      
      This flag (when on) stops Python creating .pyc files.  The test first
      checks that .pyc files will be created, then turns this option on and
      checks .pyc files will not be created.
      
      However, if the user has PYTHONDONTWRITEBYTECODE set in their
      environment then this will prevent Python from creating .pyc files, as
      such the first test, that .pyc files are being created, currently
      fails.
      
      We could unset PYTHONDONTWRITEBYTECODE, however, until Python 3.8
      there is no way to control where Python writes the .pyc files.  As the
      GDB developer clearly doesn't want .pyc files created in their
      file-system it feels wrong to silently unset this environment
      variable.
      
      My proposal then, is that we just spot when this environment variable
      is set and adjust the expected results.  My hope is that across all
      GDB developers some will be running with PYTHONDONTWRITEBYTECODE
      unset, so this feature will be fully tested at least some of the time.
      
      gdb/testsuite/ChangeLog:
      
      	PR testsuite/27788
      	* gdb.python/py-startup-opt.exp (test_python_settings): Change the
      	expected results when environment variable PYTHONDONTWRITEBYTECODE
      	is set.
      d389a1a7
    • Alan Modra's avatar
      PPC: undefweak dynamic relocs · 49160308
      Alan Modra authored
      This makes the default for ppc to keep dynamic relocs on undefweak
      symbols when the code won't cause DT_TEXTREL (for instance when -fPIE
      or -fPIC).  If ld is given -z dynamic-undefined-weak then dynamic
      relocations will be created for non-PIC at the expense of possibly
      causing DT_TEXTREL to be set on ppc32.  Note that DT_TEXTREL and GNU
      indirect functions are incompatible.
      
      	* elf32-ppc.c (allocate_dynrelocs): Keep dyn_relocs for undefweak
      	symbols when -z dynamic-undefined-weak or when there are no
      	dynamic relocs in read-only sections and -z nodynamic-undefined-weak
      	is not given.
      	* elf64-ppc.c (allocate_dynrelocs): Likewise.
      49160308
    • Alan Modra's avatar
      PPC: ensure_undef_dynamic on weak undef only in plt · b2936612
      Alan Modra authored
      It's slightly weird to have a call to a weak function not protected by
      a test of that function being non-NULL, but the non-NULL test might be
      covered by a test of another function.  For example:
        if (func1)
          {
            func1 ();
            func2 ();
          }
      where func2 is known to exist if func1 exists.
      
      	* elf32-ppc.c (allocate_dynrelocs): Call ensure_undef_dynamic for
      	weak undefined symols that only appear on PLT relocs.
      	* elf64-ppc.c (allocate_dynrelocs): Likewise.
      b2936612
    • Alan Modra's avatar
      PR27755, powerpc-ld infinite loop · 337d0bf8
      Alan Modra authored
      	PR 27755
      	* elf32-ppc.c (ppc_elf_inline_plt): Do increment rel in loop.
      337d0bf8
    • Alan Modra's avatar
      csky: fix annobin test fails · 5072b52d
      Alan Modra authored
      	* elf32-csky.c (is_mapping_symbol_name): New function.
      	(csky_elf_is_target_special_symbol): Likewise.
      	(csky_elf_maybe_function_sym): Likewise.
      	(bfd_elf32_bfd_is_target_special_symbol): Define.
      	(elf_backend_maybe_function_sym): Define.
      5072b52d
    • Alan Modra's avatar
      testsuite: Don't start directives in first column · db543a7d
      Alan Modra authored
      Fixes fails on hppa64-hp-hpux11.23
      
      	* testsuite/gas/elf/section25.s: Don't start directives in first
      	column.
      	* testsuite/gas/elf/section26.s: Likewise.
      db543a7d
    • Alan Modra's avatar
      Re: section symbols without a name · df6fbc21
      Alan Modra authored
      commit 23356397 changed this file but missed one place.
      
      	* testsuite/ld-s390/tlspic_64.rd: Adjust expected output for
      	named section symbols.
      df6fbc21
    • GDB Administrator's avatar
      Automatic date update in version.in · d68fbfe7
      GDB Administrator authored
      d68fbfe7
  3. May 02, 2021
    • Simon Marchi's avatar
      sim: add default cases to two switches in sim-options.c · 72042732
      Simon Marchi authored
      This is the next compilation error I hit when I build all targets with
      Clang:
      
          /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-options.c:234:12: error: no case matching constant switch condition '0' [-Werror]                                                                    switch (WITH_ENVIRONMENT)
                            ^~~~~~~~~~~~~~~~                                                                                                                                                                 ./config.h:215:26: note: expanded from macro 'WITH_ENVIRONMENT'
          #define WITH_ENVIRONMENT ALL_ENVIRONMENT                                                                                                                                                                                    ^~~~~~~~~~~~~~~
          /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-options.c:276:15: error: no case matching constant switch condition '0' [-Werror]                                                                switch (WITH_ALIGNMENT)
                        ^~~~~~~~~~~~~~                                                                                                                                                                       /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-config.h:220:24: note: expanded from macro 'WITH_ALIGNMENT'
          #define WITH_ALIGNMENT 0
                                 ^
      
      This is a little bit special because these are switches on compile-time
      value.  But regardless, the idea is that we logically can't reach the
      switches if WITH_ENVIRONMENT == 0 or WITH_ALIGNMENT == 0, so the code is
      correct.
      
      In addition to getting rid of the compiler warning, adding default cases
      to these switches ensure that if we do get in an unexpected situation,
      it is caught.  In GDB, I'd use gdb_assert_not_reached, I don't know if
      there is something similar in sim so I went with abort.
      
      sim/common/ChangeLog:
      
      	* sim-options.c (standard_option_handler): Add default cases to
      	switches.
      
      Change-Id: Ie237d67a201caa6b72de0d17cc815193417156b6
      72042732
    • Mike Frysinger's avatar
      sim: replace custom attributes with ansidecl.h · f0c4dc40
      Mike Frysinger authored
      A lot of this code predates the common attributes.  We had already
      started migrating over piece by piece, so just do a pass across all
      the attributes and replace most of them.
      f0c4dc40
    • Mike Frysinger's avatar
      sim: bfin: move option inits to respective modules · d89a87ba
      Mike Frysinger authored
      Now that modules can self declare their own init funcs, change the mmu
      and mach logic to use it.  We don't need to export the option symbols
      or specifically call this logic from the sim_open function anymore.
      d89a87ba
    • Mike Frysinger's avatar
      sim: options: fix --help output · e4821e2f
      Mike Frysinger authored
      The hash table rewrite broke --help output due to subtle behavior:
      calling dup_arg_p(NULL) will create & clear the table, not just
      create it.  The --help output relies on this to clear the table
      before it shows things.
      e4821e2f
    • Mike Frysinger's avatar
      sim: dv-sockser: localize init callback · 328e805b
      Mike Frysinger authored
      Now that we don't need to hardcode the module init list in a single
      place, move the dv-sockser logic to the place to the one file.
      328e805b
    • Mike Frysinger's avatar
      sim: mips: mark local func static · adbaa7b8
      Mike Frysinger authored
      adbaa7b8
    • Mike Frysinger's avatar
      sim: add framework for declaring init callbacks locally · 8e5f1516
      Mike Frysinger authored
      To facilitate decentralized module initialization/registration with an
      eye towards multi-target support, add a framework to detect init calls
      declared in the source and automatically call them.  This is akin to
      gdb's _initialize_xxx framework for letting modules autodiscover.
      8e5f1516
    • GDB Administrator's avatar
      Automatic date update in version.in · d113096b
      GDB Administrator authored
      d113096b
    • Mike Frysinger's avatar
      sim: nrun: add local strsignal prototype · fe348617
      Mike Frysinger authored
      While libiberty provides a definition for this for systems that lack
      the function (e.g. Windows), it doesn't provide a prototype.  So add
      our own local copy in the one file that uses the func.
      fe348617
    • Mike Frysinger's avatar
      sim: rx: cast bfd_vma when printing · 2a83fd8f
      Mike Frysinger authored
      A bit of a hack, but it's what we've been doing so far when printing
      bfd_vma's since bfd doesn't provide PRI helper types for us to use.
      2a83fd8f
    • Mike Frysinger's avatar
      sim: riscv: fix building on 32-bit hosts w/out int128 · bd12755b
      Mike Frysinger authored
      Check for __SIZEOF_INT128__ before trying to use the builtin type.
      This fixes building on some 32-bit systems like x86.
      bd12755b
    • Mike Frysinger's avatar
      sim: aarch64: use PRIx64 for formatting 64-bit types · f1ca3215
      Mike Frysinger authored
      We can't assume that %lx is big enough for 64-bit types as it isn't on
      most 32-bit builds.  Use the standard format define for this instead.
      f1ca3215
    • Mike Frysinger's avatar
      sim: aarch64: fix 64-bit immediate shifts · ce224813
      Mike Frysinger authored
      Trying to shift immediates 63 bits fails on 32-bit systems since UL
      is only 32-bits, not 64-bits.  Switch to ULL to guarantee at least
      64-bits here.
      ce224813
    • Mike Frysinger's avatar
      sim: arm: move build logic to source files · 163cb761
      Mike Frysinger authored
      This simplifies the build logic a bit by just having source file
      inputs.  It also simplifies code that assumes there's a source
      file for each object.
      163cb761
  4. May 01, 2021
    • Mike Frysinger's avatar
      sim: callback: inline wrap helper · ccf2e592
      Mike Frysinger authored
      This is annoying as it requires inlining boiler plate, but we don't
      have much choice: the wrap helper assumes the return value is always
      an int, but that's already not the case with some of the callbacks
      which use long.  GCC has extensions to define macros-as-functions,
      but we can't assume GCC.
      ccf2e592
    • Max Filippov's avatar
      opcodes: xtensa: support branch visualization · 6aee2cb2
      Max Filippov authored
      2021-05-01  Max Filippov  <jcmvbkbc@gmail.com>
      opcodes/
      	* xtensa-dis.c (print_insn_xtensa): Fill in info->insn_type and
      	info->insn_info_valid.
      6aee2cb2
    • GDB Administrator's avatar
      Automatic date update in version.in · 698d3898
      GDB Administrator authored
      698d3898
    • Tom Tromey's avatar
      Do not separately read type units · b8efb248
      Tom Tromey authored
      Currently, the DWARF reader has a separate pass to read type units --
      create_all_type_units.  While working on other patches, I discovered
      that this caused DWARF 5 type units to be read twice, once by
      create_all_comp_units and once by create_all_type_units.
      
      There's no need any more (if there ever was) to treat type units
      differently from CUs.  So, this patch removes create_all_type_units
      and unifies the code paths.
      
      Note that the DWO code still has a second pass.  I haven't looked into
      this code yet; perhaps it can also be simplified.
      
      Regression tested using the debug-types board file on x86-64 Fedora 32.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2/read.c (dwarf2_initialize_objfile): Update.
      	(add_signatured_type_cu_to_table): Remove.
      	(create_debug_type_hash_table): Assume dwo_file is non-null.
      	(create_debug_types_hash_table): Update comment.
      	(create_all_type_units): Remove.
      	(sort_tu_by_abbrev_offset): Update comment.
      	(build_type_psymtabs): Rename from build_type_psymtabs_1.
      	(build_type_psymtabs): Remove.
      	(process_skeletonless_type_unit, dwarf2_build_psymtabs_hard):
      	Update.
      	(read_comp_units_from_section): Add types_htab, section_kind
      	parameters.
      	(create_all_comp_units): Read type units.
      b8efb248
    • Tom Tromey's avatar
      Remove dwarf2_per_bfd::all_type_units · 91eea9cc
      Tom Tromey authored
      I don't think there is any deep reason to separate CUs and TUs in
      dwarf2_per_bfd.  This patch removes all_type_units and unifies these
      two containers.  Some minor tweaks are needed to the index writers,
      because both forms of index keep CUs and TUs separate;
      
      Regression tested on x86-63 Fedora 32.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2/read.h (struct tu_stats) <nr_tus>: New member.
      	(struct dwarf2_per_bfd) <get_cutu, get_tu>: Remove
      	<get_cu>: Now inline.
      	<all_type_units>: Remove.
      	* dwarf2/read.c (dwarf2_per_bfd::~dwarf2_per_bfd): Update.
      	(dwarf2_per_bfd::get_cutu, dwarf2_per_bfd::get_cu)
      	(dwarf2_per_bfd::get_tu): Remove.
      	(dwarf2_per_bfd::allocate_signatured_type): Update nr_tus.
      	(create_signatured_type_table_from_index)
      	(create_signatured_type_table_from_debug_names)
      	(dw2_symtab_iter_next, dwarf2_base_index_functions::print_stats)
      	(dwarf2_base_index_functions::expand_all_symtabs)
      	(dw2_expand_marked_cus, dw_expand_symtabs_matching_file_matcher)
      	(dwarf2_base_index_functions::map_symbol_filenames)
      	(dw2_debug_names_iterator::next, dwarf2_initialize_objfile)
      	(add_signatured_type_cu_to_table, create_all_type_units)
      	(add_type_unit, build_type_psymtabs_1, print_tu_stats)
      	(create_all_comp_units): Update.
      	* dwarf2/index-write.c (check_dwarf64_offsets, write_gdbindex)
      	(write_debug_names): Update.
      91eea9cc
    • Tom Tromey's avatar
      Allocate dwarf2_per_cu_data with 'new' · 0d305d5c
      Tom Tromey authored
      In a patch series I am working on, I'd like to have a non-POD member
      in dwarf2_per_cu_data.  This currently can't be done because
      dwarf2_per_cu_data is allocated on an obstack and initialized with
      memset.
      
      This patch changes the DWARF reader to allocate objects of this type
      with 'new'.  The various "subclasses" of this type (signatured_type in
      particular) are now changed to derive from dwarf2_per_cu_data, and
      also use 'new' for allocation.
      
      Regression tested on x86-64 Fedora 32.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tom@tromey.com>
      
      	* dwarf2/read.h (struct dwarf2_per_bfd) <allocate_per_cu,
      	allocate_signatured_type>: Change return type.
      	<all_comp_units, all_type_units>: Hold unique pointers.
      	(struct dwarf2_per_cu_data): Add constructor and initializers.
      	(struct signatured_type): Derive from dwarf2_per_cu_data.
      	* dwarf2/read.c (type_unit_group): Derive from
      	dwarf2_per_cu_data.
      	(dwarf2_per_bfd::get_cutu, dwarf2_per_bfd::get_cu)
      	(dwarf2_per_bfd::get_tu)
      	(dwarf2_per_bfd::allocate_signatured_type)
      	(dwarf2_per_bfd::allocate_signatured_type)
      	(create_cu_from_index_list, create_cus_from_index_list)
      	(create_signatured_type_table_from_index)
      	(create_signatured_type_table_from_debug_names)
      	(create_addrmap_from_aranges)
      	(dwarf2_base_index_functions::find_last_source_symtab)
      	(dw_expand_symtabs_matching_file_matcher)
      	(dwarf2_gdb_index::expand_symtabs_matching)
      	(dwarf2_base_index_functions::map_symbol_filenames)
      	(create_cus_from_debug_names_list)
      	(dw2_debug_names_iterator::next)
      	(dwarf2_debug_names_index::expand_symtabs_matching)
      	(create_debug_type_hash_table, add_type_unit)
      	(fill_in_sig_entry_from_dwo_entry, lookup_dwo_signatured_type):
      	Update.
      	(allocate_type_unit_groups_table): Use delete.
      	(create_type_unit_group): Change return type.  Use new.
      	(get_type_unit_group, build_type_psymtabs_1)
      	(build_type_psymtab_dependencies)
      	(process_skeletonless_type_unit, set_partial_user)
      	(dwarf2_build_psymtabs_hard, read_comp_units_from_section)
      	(create_cus_hash_table, queue_and_load_dwo_tu, follow_die_sig_1)
      	(read_signatured_type): Update.
      	(dwarf2_find_containing_comp_unit): Change type of
      	'all_comp_units'.
      	(run_test): Update.
      	(dwarf2_per_bfd::allocate_per_cu)
      	(dwarf2_per_bfd::allocate_signatured_type): Change return type.
      	Use new.
      	(add_signatured_type_cu_to_table): Update.
      	* dwarf2/index-write.c (write_one_signatured_type)
      	(check_dwarf64_offsets, psyms_seen_size, write_gdbindex)
      	(write_debug_names): Update.
      0d305d5c
    • Tom Tromey's avatar
      Make get_image_name static · 1bee48c7
      Tom Tromey authored
      The only callers of get_image_name are nat/windows-nat.c, so make it
      static.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tromey@adacore.com>
      
      	* nat/windows-nat.h (get_image_name): Don't declare.
      	* nat/windows-nat.c (get_image_name): Now static.
      1bee48c7
    • Tom Tromey's avatar
      Share DLL code between gdb and gdbserver · e228ef97
      Tom Tromey authored
      This moves the new DLL-loading code into nat/windows-nat.c, and
      changes both gdb and gdbserver to use the shared code.  One
      client-provided callback, handle_load_dll, is changed to allow the
      code to be shared.  This callback was actually never called from
      nat/windows-nat.c; maybe I had planned to share more here and then
      didn't finish... I'm not sure.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tromey@adacore.com>
      
      	* windows-nat.c (windows_nat::handle_load_dll): Update.
      	(windows_nat_target::get_windows_debug_event): Call
      	dll_loaded_event.
      	(windows_add_all_dlls, windows_add_dll): Move to
      	nat/windows-nat.c.
      	* nat/windows-nat.h (handle_load_dll): Change parameters.
      	(dll_loaded_event, windows_add_all_dlls): Declare.
      	* nat/windows-nat.c (windows_add_dll, windows_add_all_dlls): Move
      	from windows-nat.c.
      	(dll_loaded_event): New function.
      
      gdbserver/ChangeLog
      2021-04-30  Tom Tromey  <tromey@adacore.com>
      
      	* win32-low.cc (do_initial_child_stuff): Update.
      	(windows_nat::handle_load_dll): Rename from win32_add_one_solib.
      	Change parameter type.
      	(win32_add_dll, win32_add_all_dlls)
      	(windows_nat::handle_load_dll): Remove.
      	(get_child_debug_event): Call dll_loaded_event.
      e228ef97
    • Tom Tromey's avatar
      Use nat/windows-nat function indirection code · de071872
      Tom Tromey authored
      This changes gdbserver to use the function indirection code that was
      just moved into nat/windows-nat.[ch].  One additional function is used
      by gdbserver that was not used by gdb.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tromey@adacore.com>
      
      	* nat/windows-nat.h (GenerateConsoleCtrlEvent): New define.
      	(GenerateConsoleCtrlEvent_ftype, GenerateConsoleCtrlEvent):
      	Declare.
      	* nat/windows-nat.c (GenerateConsoleCtrlEvent): Define.
      	(initialize_loadable): Initialize GenerateConsoleCtrlEvent.
      
      gdbserver/ChangeLog
      2021-04-30  Tom Tromey  <tromey@adacore.com>
      
      	* win32-low.cc (GETPROCADDRESS): Remove.
      	(winapi_DebugActiveProcessStop, winapi_DebugSetProcessKillOnExit)
      	(winapi_DebugBreakProcess, winapi_GenerateConsoleCtrlEvent)
      	(winapi_Wow64SetThreadContext, win32_Wow64GetThreadContext)
      	(win32_Wow64SetThreadContext): Remove.
      	(win32_set_thread_context, do_initial_child_stuff)
      	(win32_process_target::attach, win32_process_target::detach):
      	Update.
      	(winapi_EnumProcessModules, winapi_EnumProcessModulesEx)
      	(winapi_GetModuleInformation, winapi_GetModuleInformationA):
      	Remove.
      	(win32_EnumProcessModules, win32_EnumProcessModulesEx)
      	(win32_GetModuleInformation, win32_GetModuleInformationA):
      	Remove.
      	(load_psapi): Remove.
      	(win32_add_dll, win32_process_target::request_interrupt): Update.
      	(initialize_low): Call initialize_loadable.
      de071872
    • Tom Tromey's avatar
      Move function indirection code to nat/windows-nat · 9e439f00
      Tom Tromey authored
      gdb and gdbserver both look for functions in some Windows DLLs at
      runtime.  This patch moves this code out of gdb and into
      nat/windows-nat, so it can be shared by both programs.
      
      gdb/ChangeLog
      2021-04-30  Tom Tromey  <tromey@adacore.com>
      
      	* windows-nat.c: Move code to nat/windows-nat.[ch].
      	(_initialize_windows_nat): Call initialize_loadable.
      	* nat/windows-nat.h (AdjustTokenPrivileges)
      	(DebugActiveProcessStop, DebugBreakProcess)
      	(DebugSetProcessKillOnExit, EnumProcessModules)
      	(EnumProcessModulesEx, GetModuleInformation)
      	(GetModuleFileNameExA, GetModuleFileNameExW)
      	(LookupPrivilegeValueA, OpenProcessToken, GetConsoleFontSize)
      	(GetCurrentConsoleFont, Wow64SuspendThread)
      	(Wow64GetThreadContext, Wow64SetThreadContext)
      	(Wow64GetThreadSelectorEntry): Move from windows-nat.c.
      	(AdjustTokenPrivileges_ftype)
      	(DebugActiveProcessStop_ftype, DebugBreakProcess_ftype)
      	(DebugSetProcessKillOnExit_ftype, EnumProcessModules_ftype)
      	(EnumProcessModulesEx_ftype, GetModuleInformation_ftype)
      	(GetModuleFileNameExA_ftype, GetModuleFileNameExW_ftype)
      	(LookupPrivilegeValueA_ftype, OpenProcessToken_ftype)
      	(GetConsoleFontSize_ftype)
      	(GetCurrentConsoleFont_ftype, Wow64SuspendThread_ftype)
      	(Wow64GetThreadContext_ftype, Wow64SetThreadContext_ftype)
      	(Wow64GetThreadSelectorEntry_ftype): Likewise.
      	(initialize_loadable): Declare.
      	* nat/windows-nat.c (AdjustTokenPrivileges)
      	(DebugActiveProcessStop, DebugBreakProcess)
      	(DebugSetProcessKillOnExit, EnumProcessModules)
      	(EnumProcessModulesEx, GetModuleInformation, GetModuleFileNameExA)
      	(GetModuleFileNameExW, LookupPrivilegeValueA, OpenProcessToken)
      	(GetCurrentConsoleFont, GetConsoleFontSize, Wow64SuspendThread)
      	(Wow64GetThreadContext, Wow64SetThreadContext)
      	(Wow64GetThreadSelectorEntry): Define.
      	(bad, bad_GetCurrentConsoleFont, bad_GetConsoleFontSize): Move
      	from windows-nat.c.
      	(initialize_loadable): Likewise, and rename.
      9e439f00