[DynInst_API:] [dyninst/dyninst] 2b8973: Remove Symtab::findModuleByName(Module *&, std::st...

2023-10-08 Thread Tim Haines
  Branch: refs/heads/thaines/symtab_remove_findModuleByName
  Home:   https://github.com/dyninst/dyninst
  Commit: 2b8973b9385b559eb70b16187a62cc634bd9d2a9
  
https://github.com/dyninst/dyninst/commit/2b8973b9385b559eb70b16187a62cc634bd9d2a9
  Author: Tim Haines 
  Date:   2023-10-07 (Sat, 07 Oct 2023)

  Changed paths:
M symtabAPI/doc/3-Examples.tex
M symtabAPI/doc/API/LineInfo/Iterating.tex
M symtabAPI/doc/API/Symtab/Symtab.tex
M symtabAPI/h/Symtab.h
M symtabAPI/src/Symtab-lookup.C
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove Symtab::findModuleByName(Module *&, std::string)

We consider the name of a module to be the DW_AT_name of the containing
DIE. This is either the full path name of the source file used to create
the CU or the relative path of the same with respect to the
DW_AT_comp_dir. We ensure that the module's name is always an absolute
path.

Modules have never been required to have unique names. That is, many
modules can share the same name. The following demonstrates this case:

test.c
--
  void func1(){}
  void func2(){}

$ gcc -g -c -DFUNC1 -o func1.o test.c
$ gcc -g -c -DFUNC2 -o func2.o test.c
$ gcc -g -fPIC -shared func1.o func2.o -o libfunc.so
$ readelf --debug-dump=info libfunc.so | grep -A 5 DW_TAG_compile_unit
 <0>: Abbrev Number: 1 (DW_TAG_compile_unit)
   DW_AT_producer: (indirect string, offset: 0x0): 
<11>   DW_AT_language: 29   (C11)
<12>   DW_AT_name: (indirect line string, offset: 0x19): test.c
<16>   DW_AT_comp_dir: (indirect line string, offset: 0x0): 
/path/to/test
<1a>   DW_AT_low_pc  : 0x10f9

 <0><55>: Abbrev Number: 1 (DW_TAG_compile_unit)
<56>   DW_AT_producer: (indirect string, offset: 0x0): 
<5a>   DW_AT_language: 29   (C11)
<5b>   DW_AT_name: (indirect line string, offset: 0x19): test.c
<5f>   DW_AT_comp_dir: (indirect line string, offset: 0x0): 
/path/to/test
<63>   DW_AT_low_pc  : 0x1104


___
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api


[DynInst_API:] [dyninst/dyninst] e7a98a: Merge getOrCreateModule and newModule

2023-10-08 Thread Tim Haines
  Branch: refs/heads/thaines/refactor_symtab_getOrCreateModule
  Home:   https://github.com/dyninst/dyninst
  Commit: e7a98a179ae4413877ecd6ab1554eed3b9c0d6a0
  
https://github.com/dyninst/dyninst/commit/e7a98a179ae4413877ecd6ab1554eed3b9c0d6a0
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Merge getOrCreateModule and newModule

The latter was only ever called from the former.


  Commit: c42392456eaaa751990a1d3872209d4b61010602
  
https://github.com/dyninst/dyninst/commit/c42392456eaaa751990a1d3872209d4b61010602
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove dead debug code


  Commit: 302f77d6228b9755aadea7ff59bffe4add874795
  
https://github.com/dyninst/dyninst/commit/302f77d6228b9755aadea7ff59bffe4add874795
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Do not adjust Module's address

It's unclear why this was here. This function is currently called from
only two places: BinaryEdit::writeFile and
Object::fix_global_symbol_modules_static_dwarf.

In the first, the module created is called 'dyninstInst'. This is the
only place where that name is used, so only one module would be created.
Moreover, 'writeFile' will only produce a single binary output, so there
wouldn't be multiple modules.

In the second, the module lookup will always fail because we are
creating new ones for each DWARF compilation unit (CU), and those are
guaranteed to be unique as we iterate over the results of
'dwarf_nextcu'.


  Commit: b3f0193caced247f8092365006507c3622f36118
  
https://github.com/dyninst/dyninst/commit/b3f0193caced247f8092365006507c3622f36118
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove 'directory definitions' check

This kind of name is never used manually anywhere in Dyninst and the
names that come from DWARF compilation units (CUs) are never
directories.


  Commit: 2e5592a576b5ab581415215e9efc0e54ed1f
  
https://github.com/dyninst/dyninst/commit/2e5592a576b5ab581415215e9efc0e54ed1f
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Clean up 'create' tracing message


  Commit: 78e466428ba0b69607ac89ca003b46e0fd041c62
  
https://github.com/dyninst/dyninst/commit/78e466428ba0b69607ac89ca003b46e0fd041c62
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Tidy up variable declarations.


  Commit: a6471b9e923cbc8521b00e5c697d88b16373836e
  
https://github.com/dyninst/dyninst/commit/a6471b9e923cbc8521b00e5c697d88b16373836e
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove 'assert' after 'new'.

We require exceptions to be enabled when building Dyninst and we aren't
using the 'nothrow' version of 'operator new' here. This check is
useless.


  Commit: 2d4c085ae4bfe45fe6947b3f40a4179143b6d36f
  
https://github.com/dyninst/dyninst/commit/2d4c085ae4bfe45fe6947b3f40a4179143b6d36f
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove existence check.

This will never be true because 'findModuleByOffset' would have found
the module.


  Commit: 1970192fd3f41954543607257d369e0c53f7c198
  
https://github.com/dyninst/dyninst/commit/1970192fd3f41954543607257d369e0c53f7c198
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Don't return with parens


  Commit: 04f0160705092eae99f5e1d7e4b86a00628549a1
  
https://github.com/dyninst/dyninst/commit/04f0160705092eae99f5e1d7e4b86a00628549a1
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Rename 'ret' to 'mod'.

For clarity.


  Commit: 165f6a7ad0061c905c1391d74cb28a06d154e468
  
https://github.com/dyninst/dyninst/commit/165f6a7ad0061c905c1391d74cb28a06d154e468
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  REBASE ME: fix message


Compare: 
https://github.com/dyninst/dyninst/compare/e7a98a179ae4%5E...165f6a7ad006
___
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api


[DynInst_API:] [dyninst/dyninst] cd788b: Remove Symtab::findModuleByName(Module *&, std::st...

2023-10-08 Thread Tim Haines
  Branch: refs/heads/thaines/symtab_remove_findModuleByName
  Home:   https://github.com/dyninst/dyninst
  Commit: cd788bfc4853feb5b15375c146995d26b615de47
  
https://github.com/dyninst/dyninst/commit/cd788bfc4853feb5b15375c146995d26b615de47
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/doc/3-Examples.tex
M symtabAPI/doc/API/LineInfo/Iterating.tex
M symtabAPI/doc/API/Symtab/Symtab.tex
M symtabAPI/h/Symtab.h
M symtabAPI/src/Symtab-lookup.C
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove Symtab::findModuleByName(Module *&, std::string)

A Symtab::Module is a one-to-one mapping to a DWARF compilation unit
(CU). In DWARF4, we consider a CU to be an entry in the .debug_info
section with the tag DW_TAG_compile_unit. In DWARF5, we also include
entries with the tag DW_TAG_partial_unit as they can contain symbol
definitions; we assume libdw will merge all other split unit types for
us.

The name of a module is the DW_AT_name of the containing DIE. This is
either the full path name of the source file used to create the CU or
the relative path of the same with respect to the DW_AT_comp_dir. We
ensure that the module's name is always an absolute path.

Modules have never been required to have unique names. That is, many
modules can share the same name. The following demonstrates this case:

```
test.c
--
  void func1(){}
  void func2(){}

$ gcc -g -c -DFUNC1 -o func1.o test.c
$ gcc -g -c -DFUNC2 -o func2.o test.c
$ gcc -g -fPIC -shared func1.o func2.o -o libfunc.so
$ readelf --debug-dump=info libfunc.so | grep -A 6 DW_TAG_compile_unit
 <0>: Abbrev Number: 1 (DW_TAG_compile_unit)
   DW_AT_producer: 
<11>   DW_AT_language: 29   (C11)
<12>   DW_AT_name: test.c
<16>   DW_AT_comp_dir: /path/to/test
<1a>   DW_AT_low_pc  : 0x10f9
<22>   DW_AT_high_pc : 0x1104

 <0><55>: Abbrev Number: 1 (DW_TAG_compile_unit)
<56>   DW_AT_producer: 
<5a>   DW_AT_language: 29   (C11)
<5b>   DW_AT_name: test.c
<5f>   DW_AT_comp_dir: /path/to/test
<63>   DW_AT_low_pc  : 0x1104
<6b>   DW_AT_high_pc : 0x110F
```

Because the two CUs have the same name, Dyninst throws away the contents
of the second one because this function would return the first. It is
also possible (and likely) that the two CUs have different line maps and
location lists. These, too, are discarded. Although unlikely, it is
legal for a compiler to emit CUs with overlapping PC range values. This
means the only was to uniquely identify a module is by its offset in
the .debug_info section.


___
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api


[DynInst_API:] [dyninst/dyninst] c217c3: Clean up 'create' tracing message

2023-10-08 Thread Tim Haines
  Branch: refs/heads/thaines/refactor_symtab_getOrCreateModule
  Home:   https://github.com/dyninst/dyninst
  Commit: c217c3e7f87e13e8a842041af2e0ac464f6fb69c
  
https://github.com/dyninst/dyninst/commit/c217c3e7f87e13e8a842041af2e0ac464f6fb69c
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Clean up 'create' tracing message


  Commit: 60f65255406459861b3995a4e1999554c565b9c9
  
https://github.com/dyninst/dyninst/commit/60f65255406459861b3995a4e1999554c565b9c9
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Tidy up variable declarations.


  Commit: 20f8221797456a250673b7b80ce408c5762ec6a7
  
https://github.com/dyninst/dyninst/commit/20f8221797456a250673b7b80ce408c5762ec6a7
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove 'assert' after 'new'.

We require exceptions to be enabled when building Dyninst and we aren't
using the 'nothrow' version of 'operator new' here. This check is
useless.


  Commit: 59a23a7407e099e8ed35e7ca6ba04a3ab70a2c0d
  
https://github.com/dyninst/dyninst/commit/59a23a7407e099e8ed35e7ca6ba04a3ab70a2c0d
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Remove existence check.

This will never be true because 'findModuleByOffset' would have found
the module.


  Commit: cbc85eb4349c033d7e068ea00d188bcb9b2ab164
  
https://github.com/dyninst/dyninst/commit/cbc85eb4349c033d7e068ea00d188bcb9b2ab164
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Don't return with parens


  Commit: 97d144347d3953a679704d9dbf70ac4be4f19038
  
https://github.com/dyninst/dyninst/commit/97d144347d3953a679704d9dbf70ac4be4f19038
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/Symtab.C

  Log Message:
  ---
  Rename 'ret' to 'mod'.

For clarity.


Compare: https://github.com/dyninst/dyninst/compare/165f6a7ad006...97d144347d39
___
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api


[DynInst_API:] [dyninst/dyninst] e88064: Remove commented-out code

2023-10-08 Thread Tim Haines
  Branch: refs/heads/thaines/dwarfWalker_cleanup_debug
  Home:   https://github.com/dyninst/dyninst
  Commit: e88064b67c9211dd676bc735d8b3dd423c6b4cb6
  
https://github.com/dyninst/dyninst/commit/e88064b67c9211dd676bc735d8b3dd423c6b4cb6
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/dwarfWalker.C

  Log Message:
  ---
  Remove commented-out code

It's just noise.


  Commit: cad4bd4b7ab4397f5151dc2919c130ee2a8ce973
  
https://github.com/dyninst/dyninst/commit/cad4bd4b7ab4397f5151dc2919c130ee2a8ce973
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/src/dwarfWalker.C

  Log Message:
  ---
  Remove useless comments


Compare: 
https://github.com/dyninst/dyninst/compare/e88064b67c92%5E...cad4bd4b7ab4
___
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api


[DynInst_API:] [dyninst/dyninst] 24f497: Remove Symtab::changeSymbolOffset

2023-10-08 Thread Tim Haines
  Branch: refs/heads/thaines/remove_symtab_changeSymbolOffset
  Home:   https://github.com/dyninst/dyninst
  Commit: 24f4972060b2903b4bcf2109dec6beaeec01e62b
  
https://github.com/dyninst/dyninst/commit/24f4972060b2903b4bcf2109dec6beaeec01e62b
  Author: Tim Haines 
  Date:   2023-10-08 (Sun, 08 Oct 2023)

  Changed paths:
M symtabAPI/h/Symtab.h
M symtabAPI/src/Symtab-edit.C

  Log Message:
  ---
  Remove Symtab::changeSymbolOffset

It is never used. Not a breaking change as it's private.

I have left the function of the same name in Aggregate because it's
protected, there is a virtual dtor, and that class is accessible by
users. It's possible that someone is using it.


___
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api