~ubuntu-support-team/binutils/+git/binutils-gdb:users/lsix/poke-gdb

Last commit made on 2023-02-06
Get this branch:
git clone -b users/lsix/poke-gdb https://git.launchpad.net/~ubuntu-support-team/binutils/+git/binutils-gdb

Branch merges

Branch information

Name:
users/lsix/poke-gdb
Repository:
lp:~ubuntu-support-team/binutils/+git/binutils-gdb

Recent commits

38d0150... by Lancelot SIX <email address hidden>

gdb: Add the $_poke utility function

Add the $_poke utility function so it is possible to use poke in
breakpoint condition for example.

The expression must return a poke boolean.

d734c63... by Lancelot SIX <email address hidden>

gdb/poke: Support the $reg::REGNAME syntax

Make it possible to use $reg::REGNAME to access the content of a
register from poke expressions.

21c2659... by Lancelot SIX <email address hidden>

gdb/poke: Support non 8-bits targets

Some targets might have non 8-bits bytes.

TYPE_CHECK (type) gives a number of host bytes. So to get the type
length in bits we should use TYPE_CHECK (type) * HOST_CHAR_BITS. As far
as I know, GDB does not support any non-8bits bytes hosts, but it does
not hurt to make this change. It also underline that a GDB type’s
length is given in host bytes, not target byte.

When dealing with target bytes, we should use
gdbarch_addressable_memory_unit_size to get the size of a memory unit
(in multiple of 8 bits).

I have no idea how libpoke would behave if the target has a non 8bits
byte. Whatever libpoke does, this patch have GDB do the right thing.

9d13358... by Lancelot SIX <email address hidden>

gdb/poke: Various style updates and fixes

This patch mostly contains changes which would have been comments in a
normal review.

b0c1ee0... by "Jose E. Marchesi" <email address hidden>

Integrate GNU poke in GDB

This patch integrates GNU poke (http://jemarch.net/poke) in GDB by
mean of libpoke. It allows the GDB user to execute Poke code from
within the debugger with access to the target memory, types and
values.

How this stuff works:

- GDB links with libpoke.so and uses the interface in libpoke.h.
  This is also how the GNU poke application (the command-line
  editor) is implemented.

- There are three commands:

  poke STR
  poke-add-type EXPR
  poke-add-types REGEXP
  poke-dump-types

  All three commands make sure to start the poke incremental
  compiler if it isn't running already.

- Access to the target's memory is provided by GDB by installing
  a Foreign IO device in the incremental compiler. This is
  `iod_if' in poke.c.

- Access to the terminal is provided by GDB by providing a
  pk_term_if implementation to the incremental compiler. This is
  `poke_term_if' in poke.c.

- Access to GDB values is provided by GDB by installing an alien
  token handler in the incremental compiler. This is
  `poke_alien_token_handler' in poke.c.

gdb/ChangeLog:

2021-05-10 Jose E. Marchesi <email address hidden>

 * configure.ac: Support --enable-poke.
 * configure: Regenerate.
 * Makefile.in (POKE_OBS): Define based on @POKE_OBS@.
 (DEPFILES): Add POKE_OBS.
 * poke.c: New file.

gdb/doc/ChangeLog:

2021-05-10 Jose E. Marchesi <email address hidden>

 * Makefile.in (GDB_DOC_FILES): Add poke.texi.
 * poke.texi: New file.
 * gdb.texinfo (Data): Add meny entry for Poke and @include poke.texi.

801a7ea... by "H.J. Lu" <email address hidden>

x86: Remove bfd_arch_l1om and bfd_arch_k1om

Remove bfd_arch_l1om and bfd_arch_k1om since L1OM/K1OM support has been
removed from gas, ld and opcodes.

bfd/

 * Makefile.am (ALL_MACHINES): Remove cpu-l1om.lo and cpu-k1om.lo.
 (ALL_MACHINES_CFILES): Remove cpu-l1om.c and cpu-k1om.c.
 * archures.c (bfd_mach_l1om): Removed.
 (bfd_mach_l1om_intel_syntax): Likewise.
 (bfd_mach_k1om): Likewise.
 (bfd_mach_k1om_intel_syntax): Likewise.
 (bfd_k1om_arch): Likewise.
 (bfd_l1om_arch): Likewise.
 (bfd_archures_list): Remove bfd_k1om_arch and bfd_l1om_arch
 references.
 * config.bfd (targ_selvecs): Remove l1om_elf64_vec.
 l1om_elf64_fbsd_vec, k1om_elf64_vec and k1om_elf64_fbsd_vec.
 (targ_archs): Remove bfd_l1om_arch and bfd_k1om_arch.
 * configure.ac (k1om_elf64_vec): Removed.
 (k1om_elf64_fbsd_vec): Likewise.
 (l1om_elf64_vec): Likewise.
 (l1om_elf64_fbsd_vec): Likewise.
 * cpu-k1om.c: Removed.
 * cpu-l1om.c: Likewise.
 * elf64-x86-64.c (elf64_l1om_elf_object_p): Removed.
 (elf64_k1om_elf_object_p): Likewise.
 (l1om_elf64_vec): Removed.
 (l1om_elf64_fbsd_vec): Likewise.
 (k1om_elf64_vec): Likewise.
 (k1om_elf64_fbsd_vec): Likewise.
 (ELF_TARGET_OS): Undefine.
 * targets.c (_bfd_target_vector): Remove k1om_elf64_vec,
 k1om_elf64_fbsd_vec, l1om_elf64_vec and l1om_elf64_fbsd_vec.
 * Makefile.in: Regenerate.
 * bfd-in2.h: Likewise.
 * configure: Likewise.

opcodes/

 * configure.ac: Remove bfd_arch_l1om/bfd_arch_k1om references.
 * disassemble.c (disassembler): Likewise.
 * configure: Regenerate.

89ab947... by Simon Marchi

gdb/ctf: pass partial symtab's filename to buildsym_compunit

I noticed that the CTF symbol reader passes the objfile's name to all
buildsym_compunit instances it creates. The result is that all
compunit_symtabs created have the same name, that of the objfile:

    { objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00)
      { ((struct compunit_symtab *) 0x621000286760)
        debugformat ctf
        producer (null)
        name libbabeltrace2.so.0.0.0
        dirname (null)
        blockvector ((struct blockvector *) 0x6210003911d0)
        user ((struct compunit_symtab *) (null))
            { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003911f0)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }
      { ((struct compunit_symtab *) 0x621000275c10)
        debugformat ctf
        producer (null)
        name libbabeltrace2.so.0.0.0
        dirname (null)
        blockvector ((struct blockvector *) 0x621000286710)
        user ((struct compunit_symtab *) (null))
            { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x621000286730)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }

Notice the two "name libbabeltrace2.so.0.0.0".

Change it to pass the partial_symtab's filename instead. The output
becomes:

    { objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00)
      { ((struct compunit_symtab *) 0x621000295610)
        debugformat ctf
        producer (null)
        name libbabeltrace2.so.0.0.0
        dirname (null)
        blockvector ((struct blockvector *) 0x6210003a15d0)
        user ((struct compunit_symtab *) (null))
            { symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003a15f0)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }
      { ((struct compunit_symtab *) 0x621000288700)
        debugformat ctf
        producer (null)
        name current-thread.c
        dirname (null)
        blockvector ((struct blockvector *) 0x6210002955c0)
        user ((struct compunit_symtab *) (null))
            { symtab /home/simark/src/babeltrace/src/lib/current-thread.c ((struct symtab *) 0x6210002955e0)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }

Note that the first compunit_symtab still has libbabeltrace2.so.0.0.0 as
its name. This is because the CTF symbol reader really creates a
partial symtab named like this. It appears to be because the debug info
contains information that has been factored out of all CUs and is at the
"top-level" of the objfile, outside any real CU. So it creates a
partial symtab and an artificial CU that's named after the objfile.

Change-Id: I576316bab2a3668adf87b4e6cebda900a8159b1b

af7047e... by Simon Marchi

gdb: print compunit_symtab name in "maint info symtabs"

I think it would make sense to print a compunit_symtab's name in "maint
info symtabs". If you are looking for a given CU in the list, that's
probably the field you will be looking at. As the doc of
compunit_symtab::name says, it is not meant to be a reliable file name,
it is for debugging purposes (and "maint info symtabs" exists for
debugging purposes).

Sample output with the new field:

    (gdb) maintenance info symtabs
    { objfile /home/simark/build/binutils-gdb-one-target/gdb/a.out ((struct objfile *) 0x613000005d00)
      { ((struct compunit_symtab *) 0x621000131630)
        debugformat DWARF 5
        producer GNU C17 11.2.0 -mtune=generic -march=x86-64 -g3 -O0
        name test.c
        dirname /home/simark/build/binutils-gdb-one-target/gdb
        blockvector ((struct blockvector *) 0x621000131d10)
        user ((struct compunit_symtab *) (null))
            { symtab test.c ((struct symtab *) 0x6210001316b0)
              fullname (null)
              linetable ((struct linetable *) 0x621000131d40)
            }
            { symtab /home/simark/build/binutils-gdb-one-target/gdb/test.h ((struct symtab *) 0x6210001316e0)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
            { symtab /usr/include/stdc-predef.h ((struct symtab *) 0x621000131710)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }
      { ((struct compunit_symtab *) 0x6210001170a0)
        debugformat DWARF 5
        producer GNU C17 11.2.0 -mtune=generic -march=x86-64 -g3 -O0
        name foo.c
        dirname /home/simark/build/binutils-gdb-one-target/gdb
        blockvector ((struct blockvector *) 0x621000131580)
        user ((struct compunit_symtab *) (null))
            { symtab foo.c ((struct symtab *) 0x621000117120)
              fullname (null)
              linetable ((struct linetable *) 0x6210001315b0)
            }
            { symtab /usr/include/stdc-predef.h ((struct symtab *) 0x621000117150)
              fullname (null)
              linetable ((struct linetable *) 0x0)
            }
      }
    }

Change-Id: I17b87adfac2f6551cb5bda30d59f6c6882789211

8458fb4... by Simon Marchi

gdb/ctf: don't create a buildsym_compunit when building partial symbols

I am trying to do some changes to buildsym_compunit, so I am auditing
the current uses. Something seems odd with this use of
buildsym_compunit (that this patch removes).

A buildsym_compunit is normally used when building a compunit_symtab.
That is, when expanding a partial symtab into a full compunit symtab.
In ctfread.c, a buildsym_compunit is created in ctf_start_archive, which
is only used when creating partial symtabs. At this moment, I don't
see how that's useful. ctf_start_archive creates a new
buildsym_compunit and starts a subfile. But that buildsym_compunit is
never used again. It's just overriden in ctf_start_symtab, which means
we leak the old buildsym_compunit, I suppose.

Remove ctf_start_archive completely. Add an assert in
ctf_start_symtab to verify that we are not overwriting an existing
buildsym_compunit (meaning we'd leak the existing one). This assert
triggers without the other part of the fix. When doing:

  $ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
  ...
  (gdb) maintenance expand-symtabs
  /home/simark/src/binutils-gdb/gdb/ctfread.c:1255: internal-error: ctf_start_symtab: Assertion `!ccp->builder' failed.

Change-Id: I666d146454a019f08e7305f3a1c4a974d27b4592

8839e3f... by Tom Tromey <email address hidden>

Style URLs in GDB output

I noticed that GDB will display URLs in a few spots. This changes
them to be styled. Originally I thought I'd introduce a new "url"
style, but there aren't many places to use this, so I just reused
filename styling instead. This patch also changes the debuginfod URL
list to be printed one URL per line. I think this is probably a bit
easier to read.