[all-commits] [llvm/llvm-project] bf0cda: [lldb][COFF] Rewrite ParseSymtab to list both expo...

alvinhochun via All-commits all-commits at lists.llvm.org
Wed Sep 28 02:58:23 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf0cda9ed2783a34efed3fc9804d784f7d1df242
      https://github.com/llvm/llvm-project/commit/bf0cda9ed2783a34efed3fc9804d784f7d1df242
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
    A lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml
    M llvm/include/llvm/Object/COFF.h

  Log Message:
  -----------
  [lldb][COFF] Rewrite ParseSymtab to list both export and symbol tables

This reimplements `ObjectFilePECOFF::ParseSymtab` to replace the manual
data extraction with what `COFFObjectFile` already provides. Also use
`SymTab::AddSymbol` instead of resizing the SymTab then assigning each
elements afterwards.

Previously, ParseSymTab loads symbols from both the COFF symbol table
and the export table, but if there are any entries in the export table,
it overwrites all the symbols already loaded from the COFF symbol table.
Due to the change to use AddSymbols, this no longer happens, and so the
SymTab now contains all symbols from both tables as expected.

The export symbols are now ordered by ordinal, instead of by the name
table order.

In its current state, it is possible for symbols in the COFF symbol
table to be duplicated by those in the export table. This behaviour will
be modified in a separate change.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134196


  Commit: 0870afc68e1a1ec303af1d0dbf952dd2c41f478a
      https://github.com/llvm/llvm-project/commit/0870afc68e1a1ec303af1d0dbf952dd2c41f478a
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml

  Log Message:
  -----------
  [lldb][COFF] Improve info of symbols from export table

- Skip dummy/invalid export symbols.
- Make the export ordinal of export symbols visible when dumping the
  symtab.
- Stop setting the 'Debug' flag and set the 'External' flag instead to
  better match the meaning of export symbols.
- Try to guess the type (code vs data) of the symbol from section flags.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134265


  Commit: 20c2f94c3cc10c41ab45e1be156540a06306cdf1
      https://github.com/llvm/llvm-project/commit/20c2f94c3cc10c41ab45e1be156540a06306cdf1
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
    M lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml

  Log Message:
  -----------
  [lldb][COFF] Match symbols from COFF symbol table to export symbols

If a symbol is the same as an export symbol, mark it as 'Additional' to
prevent the duplicated symbol from being repeated in some commands (e.g.
`disas -n func`). If the RVA is the same but exported with a different
name, only synchronize the symbol types.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134426


  Commit: 7ebff6ab26aa03423c61e0370377f11725184199
      https://github.com/llvm/llvm-project/commit/7ebff6ab26aa03423c61e0370377f11725184199
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml

  Log Message:
  -----------
  [lldb][COFF] Load absolute symbols from COFF symbol table

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134517


  Commit: acf7d081198f380d6ad2a1b859930e50a9cf2dae
      https://github.com/llvm/llvm-project/commit/acf7d081198f380d6ad2a1b859930e50a9cf2dae
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    A lldb/test/Shell/ObjectFile/PECOFF/symbols-forwarder-export.yaml

  Log Message:
  -----------
  [lldb][COFF] Add note to forwarder export symbols in symtab

Forwarder exports do not point to a real function or variable. Instead
they point to a string describing which DLL and symbol to forward to.
Any imports which uses them will be redirected by the loader
transparently. These symbols do not have much use in LLDB, but keep them
just in case someone find it useful. Also set a synthesized name with
the forwarder string for informational purpose.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134518


  Commit: 8a67a05e93349e341d1325f1a6428d1373f77177
      https://github.com/llvm/llvm-project/commit/8a67a05e93349e341d1325f1a6428d1373f77177
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-09-28 (Wed, 28 Sep 2022)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
    M lldb/test/Shell/ObjectFile/PECOFF/symbols-export-table.yaml

  Log Message:
  -----------
  [lldb][COFF] Map symbols without base+complex type as 'Data' type

Both LLD and GNU ld write global/static variables to the COFF symbol
table with `IMAGE_SYM_TYPE_NULL` and `IMAGE_SYM_DTYPE_NULL` type. Map
these symbols as 'Data' type in the symtab to allow these symbols to be
used in expressions and printable.

Reviewed By: labath, DavidSpickett

Differential Revision: https://reviews.llvm.org/D134585


Compare: https://github.com/llvm/llvm-project/compare/759bedade53e...8a67a05e9334


More information about the All-commits mailing list