Skip to content
Snippets Groups Projects
  1. Mar 16, 2023
    • Alan Modra's avatar
      cpu/mem.opc whitespace tidy · 3e8b13bf
      Alan Modra authored
      cpu/
      	* mep.opc: Whitespace and formatting.
      opcodes/
      	* mep-asm.c: Regenerate.
      	* mep-dis.c: Regenerate.
      3e8b13bf
    • Alan Modra's avatar
      PR30217, dynamic relocations using local dynamic symbols · 0961e631
      Alan Modra authored
      glibc's ld.so ignores local dynamic symbols.  It's been that way
      forever.  We therefore can't use them on dynamic relocations.  Fixing
      that problem uncovered another problem in sorting of dynamic relocs,
      caused no doubt by copying make_iplt_section (where we don't want
      reloc sorting by the generic gold function, we want iplt relocs last)
      to make_lplt_section (where we do want sorting).
      
      	PR 30217
      	* powerpc.cc (branch_needs_plt_entry): New function.
      	(Target_powerpc::plt_off): Use it here..
      	(Target_powerpc::Scan::global): ..and here to correct PLT16 reloc
      	handling for forced-local global symbols.
      	(Output_data_plt_powerpc::add_entry): Rename "stash"
      	parameter "is_local".  Emit relative relocs for globals that
      	are forced local, and don't set_needs_dynsym_entry.
      	(Target_powerpc::make_lplt_section): Don't create a separate
      	reloc section, use rela_dyn.
      	(Target_powerpc::make_brlt_section): Likewise.
      0961e631
    • Alan Modra's avatar
      Re: Sanity check read_section_stabs_debugging_info · d56e433a
      Alan Modra authored
      	* rddbg.c (read_section_stabs_debugging_info): Don't segfault on
      	zero size string section.
      d56e433a
    • GDB Administrator's avatar
      Automatic date update in version.in · 5a8b54ae
      GDB Administrator authored
      5a8b54ae
  2. Mar 15, 2023
    • Tom Tromey's avatar
      Fix formatting in gdb/printing.py · 06e8a3a9
      Tom Tromey authored
      According to black 23, gdb/printing.py was mis-formatted.  This patch
      fixes it.
      06e8a3a9
    • Aditya Vidyadhar Kamath's avatar
      Enable vector register visibility in core for AIX. · a8ea150e
      Aditya Vidyadhar Kamath authored
      This patch enables AIX folks to see vector register contents while they
      analyse the core file.
      a8ea150e
    • Tom de Vries's avatar
      [gdb/testsuite] Fix re-used exec in gdb.arch/ftrace-insn-reloc.exp · 5d47e20b
      Tom de Vries authored
      In test-case gdb.arch/ftrace-insn-reloc.exp we generate two executables with
      the same name, which is confusing and known to cause trouble.
      
      Fix this by making the executable names unique.
      
      Tested on x86_64-linux.
      5d47e20b
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.arch/amd64-stap-special-operands.exp for remote host · fdefd3b5
      Tom de Vries authored
      With test-case gdb.arch/amd64-stap-special-operands.exp and host board
      local-remote-host-notty and target board native-gdbserver I run into:
      ...
      (gdb) break -pstap three_arg^M
      No probe matching objfile=`<any>', provider=`<any>', name=`three_arg'^M
      Make breakpoint pending on future shared library load? (y or [n]) n^M
      (gdb) FAIL: gdb.arch/amd64-stap-special-operands.exp: probe: three_arg: \
        gdb_breakpoint: set breakpoint at -pstap three_arg
      ...
      due to compiling two executables with the same name, and when uploading the
      second one from host to build, we run into:
      ...
      Upload from 127.0.0.1 failed, \
        $outputs/gdb.arch/amd64-stap-special-operands/amd64-stap-special-operands: \
        Text file busy.
      ...
      
      Fix this by making the executable names unique.
      
      Tested on x86_64-linux.
      fdefd3b5
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.arch/i386-pkru.exp for native-gdbserver · 7b0d27b6
      Tom de Vries authored
      With test-case gdb.arch/i386-pkru.exp and target board native-gdbserver we run
      into:
      ...
      FAIL: gdb.arch/i386-pkru.exp: variable after reading pkru
      ...
      
      This looks similar to the the problem for which there's already an xfail, so
      fix this by extending the xfail matching.
      
      Tested on x86_64-linux.
      
      Also tested on openSUSE Tumbleweed, where all tests in the test-case pass.
      7b0d27b6
    • Tom de Vries's avatar
      [gdb/testsuite] Unset DEBUGINFOD_URLS on remote host · 86091eae
      Tom de Vries authored
      When running test-case gdb.arch/i386-pkru.exp with host board
      local-remote-host-notty and target board native-gdbserver on openSUSE
      Tumbleweed (with DEBUGINFOD_URLS set), I run into:
      ...
      This GDB supports auto-downloading debuginfo from the following URLs:^M
        <https://debuginfod.opensuse.org/>^M
      Enable debuginfod for this session? (y or [n]) ^CQuit^M
      (gdb) FAIL: gdb.arch/i386-pkru.exp: runto: run to main
      ...
      
      The problem is that the unsetenv for DEBUGINFOD_URLS in default_gdb_init:
      ...
          # If DEBUGINFOD_URLS is set, gdb will try to download sources and
          # debug info for f.i. system libraries.  Prevent this.
          unset -nocomplain ::env(DEBUGINFOD_URLS)
      ...
      doesn't work on remote host.
      
      Fix this by using "set debuginfod enabled off" for remote host.
      
      Tested on x86_64-linux.
      86091eae
    • Tom de Vries's avatar
      [gdb/testsuite] Fix gdb.arch/amd64*.exp with local-remote-host-native.exp · 81a7a72f
      Tom de Vries authored
      There's a number of gdb.arch/amd64*.exp test-cases that fail with host+target
      board local-remote-host-native.exp because of using a .S file, generated from
      a .c file.
      
      If a test-case compiles the .S file when executing on remote host,
      the .S file is already copied from build to host, such that it's available for
      the compiler.
      
      But that's not the case for the .c file, which is needed by gdb to show a
      source line:
      ...
      (gdb) continue^M
      Continuing.^M
      ^M
      Breakpoint 2, fn2 (y=y@entry=25, x=x@entry=6) at amd64-entry-value-inline.c:32^M
      32      in gdb.arch/amd64-entry-value-inline.c^M
      (gdb) FAIL: gdb.arch/amd64-entry-value-inline.exp: continue to breakpoint: \
        break-here
      ...
      
      Fix this by using "gdb_remote_download host <.c file>".
      
      Tested on x86_64-linux, with host+target board local-remote-host-native.
      81a7a72f
    • Nick Clifton's avatar
      Add --enable-linker-version option to bfd linker to add an entry in the .comment section. · 2d5783fa
      Nick Clifton authored
         PR 30187
        * NEWS: Mention the new feature. * ld.texi: Document the new feature. * ldgram.y: Handle LINKER_VERSION token. * ldlang.c (lang_add_version): New function. (enable_linker_version): New global variable. * ldlang.h (land_add_version): Prototype. (enable_linker_version): Export. * ldlex.h (OPTION_ENABLE_LINKER_VERSION): Define. (OPTION_DISABLE_LINKER_VERSION): Define. * ldlex.l (LINKER_VERSION): Add token. * lexsup.c (ld_options): Add --enable-linker-version and --disable-linker-version. (parse_args): Handle the new options. * scripttempl/arclinux.sc: Remove stabs and comment sections and replace with inclusion of misc-sections.sc * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/ft32.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/script.exp: Run new tests. * scripttempl/misc-sections.sc: New file. * testsuite/ld-scripts/ld-version-2.d: New file. * testsuite/ld-scripts/ld-version.d: New file. * testsuite/ld-scripts/ld-version.t: New file.
      2d5783fa
    • Nick Clifton's avatar
      Fix an illegal memory access when disassembling a corrupt MeP file. · 71f646f2
      Nick Clifton authored
        PR 30231
        * mep.opc (mep_print_insn): Check for an out of range index.
      71f646f2
    • Nick Clifton's avatar
      Fix an illegal memory access when disassebling a corrupt ARM file. · 77186045
      Nick Clifton authored
        PR 30230
        * arm-dis.c (get_sym_code_type): Check for non-ELF symbols.
      77186045
    • GDB Administrator's avatar
      Automatic date update in version.in · 48c35a82
      GDB Administrator authored
      48c35a82
  3. Mar 14, 2023
    • Tom Tromey's avatar
      Implement DAP variables, scopes, and evaluate requests · 8900a92e
      Tom Tromey authored
      The DAP code already claimed to implement "scopes" and "evaluate", but
      this wasn't done completely correctly.  This patch implements these
      and also implements the "variables" request.
      
      After this patch, variables and scopes correctly report their
      sub-structure.  This also interfaces with the gdb pretty-printer API,
      so the output of pretty-printers is available.
      
      8900a92e
    • Tom Tromey's avatar
      Hide the implementation of gdb_mpf · d0aa28e1
      Tom Tromey authored
      This renames the data member of gdb_mpf and makes it private.  It also
      adds a single new method to aid in this change.  Unlike the earlier
      changes here, I did this one all together because gdb_mpf has very few
      uses.
      
      
      d0aa28e1
    • Tom Tromey's avatar
      Rename gdb_mpq::val and make contents private · 81768386
      Tom Tromey authored
      This changes gdb_mpq to hide its data, and renames the data member
      from 'val' to 'm_val', following gdb convention.
      
      
      81768386
    • Tom Tromey's avatar
      Add operators and methods to gdb_mpq · 7607de94
      Tom Tromey authored
      This adds some operators and methods to gdb_mpq, in preparation for
      making its implementation private.
      
      This only adds the operators currently needed by gdb.  More could be
      added as necessary.
      
      
      7607de94
    • Tom Tromey's avatar
      Rename gdb_mpz::val and make contents private · 7aeae94f
      Tom Tromey authored
      This changes gdb_mpz to hide its data, and renames the data member
      from 'val' to 'm_val', following gdb convention.
      
      
      7aeae94f
    • Tom Tromey's avatar
      Add methods and operators to gdb_mpz · 302273ca
      Tom Tromey authored
      This adds various methods and operators to gdb_mpz, as a step toward
      hiding the implementation.
      
      This only adds the operators that were needed.  Many more could be
      added as required.
      
      
      302273ca
    • Tom Tromey's avatar
      Clean up gmp-utils.h includes · c8a67010
      Tom Tromey authored
      gmp-utils.h includes "defs.h", but normally the rule in gdb is that
      the .c files include this first.  This patch changes this code to
      match the rest of gdb.
      
      
      c8a67010
    • Tom Tromey's avatar
      Fix DAP frame bug with older versions of Python · 85c72d70
      Tom Tromey authored
      
      Tom de Vries pointed out that one DAP test failed on Python 3.6
      because gdb.Frame is not hashable.
      
      This patch fixes the problem by using a list to hold the frames.  This
      is less efficient but there normally won't be that many frames.
      
      Tested-by: default avatarTom de Vries <tdevries@suse.de>
      85c72d70
    • Nick Clifton's avatar
      Prevent an over large memory allocation in readelf when parsing a corrupt DWARF file. · 97b75c42
      Nick Clifton authored
        PR 30227
        * dwarf.c (process_cu_tu_index): Prevent excessive memory allocation when nused is large and ncols is zero.
      97b75c42
    • Tom de Vries's avatar
      [gdb/testsuite] Add gdb.testsuite/board-sanity.exp · ff581559
      Tom de Vries authored
      Add a test-case that tests the sanity of target/host boards.
      
      It contains a number of tests related to remote file manipulation, exercising:
      - remote_upload
      - remote_download
      - remote_file exists
      - remote_file delete
      which check that these work together as expected.
      
      Tested on x86_64-linux, with all relevant gdb/testsuite/boards/*.exp boards.
      
      For target board remote-stdio-gdbserver.exp, this revealed a trivial problem
      with the return value of proc ${board}_file for delete, so fix this.
      
      The test-case shows that the proc ${board}_download in
      local-remote-host-native.exp is broken, so remove it.
      
      Likewise for board local-remote-host.exp, so remove proc ${board}_download and
      associated ${board}_file.
      
      Tested on x86_64-linux.
      ff581559
    • Nick Clifton's avatar
      Adjust the decoded line output to fit into 80 columns. · 7506fc9b
      Nick Clifton authored
        PR 30216
        * dwarf.c (display_debug_lines_decoded): Reduce space for filenames.
        * testsuite/binutils-all/dw5.W: Adjust expected output.
        * testsuite/binutils-all/objdump.WL: Adjust expected output.
      7506fc9b
    • Nick Clifton's avatar
      Fix assembler documentation regarding data directives. · 2dd1c6e8
      Nick Clifton authored
       PR 30206
       * doc/as.texi (Pseudo Ops): Document that data directives such as .byte and .int are not intended for encoding instructions.
      2dd1c6e8
    • Alan Modra's avatar
      objdump segfault after symbol table error · c8b3d02c
      Alan Modra authored
      This memcpy segfaults if symcount is -1 (=> syms is NULL).
            memcpy (sorted_syms, symcount ? syms : dynsyms,
      	      sorted_symcount * sizeof (asymbol *));
      
      	* objdump.c (slurp_symtab): Don't leave symcount as -1 after
      	an error.
      	(slurp_dynamic_symtab): Likewise for dynsymcount.
      c8b3d02c
    • Alan Modra's avatar
      Sanity check read_section_stabs_debugging_info · 746598e0
      Alan Modra authored
      	* rddbg.c (read_section_stabs_debugging_info): Exclude sections
      	without contents.  Use bfd_malloc_and_get_section.  Don't alloc
      	one extra for strings.
      746598e0
    • Alan Modra's avatar
      gas/read.c: init more statics · f049c189
      Alan Modra authored
      	* read.c (current_name, current_label, dwarf_file, dwarf_line): Move
      	to file scope.
      	(pobegin): Tidy pop_override_ok.
      	(read_a_source_file): Make last_eol an auto var.
      	(s_reloc): Constify bfd_relocs.
      	(read_begin): Init more variables.
      f049c189
    • Alan Modra's avatar
      gas .include and .incbin · adb9ac5f
      Alan Modra authored
      This fixes a bug in .include and .incbin where given an absolute path
      the -I dirs would be searched for the path.
      
      	* read.c (include_dir_count, include_dir_maxlen): Make them size_t.
      	(search_and_open): New function.
      	(s_incbin, s_include): Use search_and_open.
      	(init_include_dir): New function.
      	(add_include_dir): Don't set initial "." dir here.
      	* read.h (include_dir_count, include_dir_maxlen): Update.
      	(init_include_dir, search_and_open): Declare.
      	* as.c (gas_early_init): Call init_include_dir.
      	* config/tc-rx.c (rx_include): Avoid warning by using size_t.
      	* config/tc-tic54x.c (tic54x_set_default_include): Simplify and
      	use notes for include path.
      	(tic54x_mlib): Use search_and_open.
      adb9ac5f
    • Alan Modra's avatar
      gas/dwarf2dbg.c init more statics · a2aee680
      Alan Modra authored
      	* dwarf2dbg.c (dw2_line, dw2_filename): Move to file scope and..
      	(dwarf2_gen_line_info): ..renamed from here.
      	(label_num, last_used, last_used_dir_len): Move to file scope.
      	(dwarf2_init): Init moved statics, except last_used_dir_len.
      a2aee680
    • Alan Modra's avatar
      gas/ecoff.c: don't use zero struct copies to init · fb977255
      Alan Modra authored
      It might have made sense once upon a time, but doesn't nowadays when
      compilers expand memset inline.
      
      	* ecoff.c (add_aux_sym_tir, allocate_scope, allocate_vlinks),
      	(allocate_shash, allocate_thash, allocate_tag, allocate_forward),
      	(allocate_thead, allocate_lineno_list): Use memset rather than
      	copying zero struct.
      fb977255
    • Alan Modra's avatar
      gas/compress-debug.c init all of strm · 4c6f9528
      Alan Modra authored
      	* compress-debug.c (compress_init): Clear all of strm.
      4c6f9528
    • GDB Administrator's avatar
      Automatic date update in version.in · 712d71a2
      GDB Administrator authored
      712d71a2
  4. Mar 13, 2023
    • Andrew Burgess's avatar
      gdb: add gdbarch::displaced_step_buffer_length · deb65a3c
      Andrew Burgess authored
      
      The gdbarch::max_insn_length field is used mostly to support displaced
      stepping; it controls the size of the buffers allocated for the
      displaced-step instruction, and is also used when first copying the
      instruction, and later, when fixing up the instruction, in order to
      read in and parse the instruction being stepped.
      
      However, it has started to be used in other places in GDB, for
      example, it's used in the Python disassembler API, and it is used on
      amd64 as part of branch-tracing instruction classification.
      
      The problem is that the value assigned to max_insn_length is not
      always the maximum instruction length, but sometimes is a multiple of
      that length, as required to support displaced stepping, see rs600,
      ARM, and AArch64 for examples of this.
      
      It seems to me that we are overloading the meaning of the
      max_insn_length field, and I think that could potentially lead to
      confusion.
      
      I propose that we add a new gdbarch field,
      gdbarch::displaced_step_buffer_length, this new field will do
      exactly what it says on the tin; represent the required displaced step
      buffer size.  The max_insn_length field can then do exactly what it
      claims to do; represent the maximum length of a single instruction.
      
      As some architectures (e.g. i386, and amd64) only require their
      displaced step buffers to be a single instruction in size, I propose
      that the default for displaced_step_buffer_length will be the
      value of max_insn_length.  Architectures than need more buffer space
      can then override this default as needed.
      
      I've updated all architectures to setup the new field if appropriate,
      and I've audited all calls to gdbarch_max_insn_length and switched to
      gdbarch_displaced_step_buffer_length where appropriate.
      
      There should be no user visible changes after this commit.
      
      Approved-By: default avatarSimon Marchi <simon.marchi@efficios.com>
      deb65a3c
    • Andrew Burgess's avatar
      gdbarch: make invalid=True the default for all Components · 564cddf8
      Andrew Burgess authored
      
      This commit switches the default value for the 'invalid' field from
      False to True.  All components that previous set the invalid field to
      True explicitly have had the field removed.
      
      I think that True is a good choice for the default, this means that we
      now get the validity checks by default, and if anyone adds a new
      Component they need to make a choice to add an 'invalid=False' line
      and disable the validation.
      
      The flip side of this is that 'invalid=False' seems to be far more
      common than 'invalid=True'.  But I don't see a huge problem with this,
      we shouldn't be aiming to reduce our typing, rather we should choose
      based on which is least likely to introduce bugs.  I think assuming
      that we should do a validity check will achieve that.
      
      Some additional components need to have an 'invalid=False' line added
      to their definition, these are components that have a predefault
      value, which is sufficient; the tdep code doesn't need to replace this
      value if it doesn't want to.
      
      Without adding the 'invalid=False' these components would be
      considered to be invalid if they have not changed from their
      predefault value -- but the predefault is fine.
      
      There's no change in the generated code after this commit, so there
      will be no user visible changes after this commit.
      
      Approved-By: default avatarSimon Marchi <simon.marchi@efficios.com>
      564cddf8
    • Andrew Burgess's avatar
      gdbarch: remove some unneeded predefault="0" from gdbarch_components.py · a3e200ef
      Andrew Burgess authored
      
      I noticed that there are a bunch of 'predefault="0"' lines in
      gdbarch_components.py, and that some (just some, not all) of these are
      not needed.
      
      The gdbarch is already zero initialized, but these lines seem to
      exists so that we can know when to compare against "0" and when to
      compare against "NULL".  At least, this seems to be useful in some
      places in the generated code.
      
      Specifically, if we remove the predefault="0" line from the
      max_insn_length component then we end up generating a line like:
      
        gdb_assert (gdbarch->max_insn_length != NULL);
      
      which doesn't compile as we compare a ULONGEST to NULL.
      
      In this commit I remove all the predefault="0" lines that I claim are
      obviously not needed.  These are lines for components that are not
      Values (i.e. the component holds a function pointer anyway), or for
      Value components that hold a pointer type, in which case using NULL is
      fine.
      
      The only changes after this commit are some fields that have nullptr
      as their initial value, and gcore_bfd_target now compares to NULL not
      0 in gdbarch_gcore_bfd_target_p, which, given the field is of type
      'const char *', seems like an improvement.
      
      Approved-By: default avatarSimon Marchi <simon.marchi@efficios.com>
      a3e200ef
    • Andrew Burgess's avatar
      gdbarch: improve generation of validation in gdbarch getters · c317ea57
      Andrew Burgess authored
      
      We currently generate some validation code within the gdbarch getter
      methods.
      
      This commit adjusts the algorithm used to generate this validation
      slightly to make the gdbarch.py code (I think) clearer; there's no
      significant changes to what is generated.
      
      The validation algorithm for gdbarch values is now:
      
        - If the Value has an 'invalid' field that is a string, use that for
          validation,
      
        - If the Value has its 'predicate' field set to true, then check the
          predicate returns true, this ensures the predicate has been
          called,
      
        - If the Value has its 'invalid' field set to True, or the Value has
          'postdefault' field, then check the fields has changed from its
          initial value,
      
        - Otherwise no validation is performed.
      
      The only changes after this commit are:
      
        - Some comments change slightly, and
      
        - For 'gcore_bfd_target' and 'max_insn_length' we now validate by
          calling the predicate rather than checking the field value
          directly, the underlying check being performed is unchanged
          though.
      
      There should be no user visible changes after this commit.
      
      Approved-By: default avatarSimon Marchi <simon.marchi@efficios.com>
      c317ea57
    • Andrew Burgess's avatar
      gdbarch: use predefault for more value components within gdbarch · 35079684
      Andrew Burgess authored
      
      For some reason the following value components of gdbarch:
      
        bfloat16_format
        half_format
        float_format
        double_format
        long_double_format
        so_ops
      
      All use a postdefault but no predefault to set the default value for
      the component.
      
      As the postdefault values for these components are all constant
      pointers that don't depend on other fields within the gdbarch, then I
      don't see any reason why we couldn't use a predefault instead.
      
      So lets do that.
      
      Approved-By: default avatarSimon Marchi <simon.marchi@efficios.com>
      35079684
Loading