History log of /haiku/src/kits/debug/SymbolLookup.cpp
Revision Date Author Comments
# 992ae400 18-Jan-2020 Murai Takashi <tmurai01@gmail.com>

Fix catching by value

Pointed out by LGTM.
Change-Id: I223655c728305f6f45b3738553da5b7d7a69e8c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2134
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 196ab88d 30-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Extend debug_create_symbol_lookup_context().

- debug_create_symbol_lookup_context() now takes an image ID
parameter that can optionally be used to restrict the symbols
it gathers to only those of the targeted image rather than the
entire team, allowing for significantly more lightweight usage
when the desired image is known. The previous behavior can still
be obtained if desired by passing -1 as said ID.

- Adjust callers.


# ffbf0328 20-Mar-2013 Pawel Dziepak <pdziepak@quarnos.org>

debug: update debug kit to correctly recognize commpage


# c0166cf2 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Should check for ELF_CLASS, not ELFCLASS32.


# a731ad19 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

ELF64 and x86_64 support in the debug kit.


# 6e2f6d1a 29-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Changed cookie type for get_next_area_info() to ssize_t.

The cookie is used to store the base address of the area that was just
visited. On 64-bit systems, int32 is not sufficient. Therefore, changed
to ssize_t which retains compatibility on x86 while expanding to a
sufficient size on x86_64.


# 9774f385 03-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added debug_get_symbol(). It's not implemented particularly efficiently, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31392 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39df6341 15-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added debug_get_symbol_iterator_image_info() to get an image_info from a
symbol iterator.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30168 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73677f78 12-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Some refactoring: There are three ways to access the symbols of an image.
Formerly two were implemented in ImageFile (from file, via syscalls) and one
in SymbolLookup (via the debugger interface). Now there's a base class Image
and respective derived classes implementing those methods.
* Simplified SymbolIterator.
* Moved the classes into sub-namespace BPrivate::Debug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30142 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 366f546e 28-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Don't fail when the runtime loader debug area can't be found. When we
can load the image files, we can still do symbol lookups just fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27774 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 95d4a71d 23-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Rather use MAP_PRIVATE instead of MAP_SHARED. It doesn't make a
difference ATM, but will, when we change the semantics of MAP_PRIVATE to
imply MAP_COPY.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27714 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0be39a3a 22-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Rather use the new _kern_read_kernel_image_symbols() syscall to use
kernel image symbol tables.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27688 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ada3268 21-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Also store the string table size for an image. This helps to improve the
symbol name len check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d8b24b47 21-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Made SymbolLookup safe to be used for the kernel team. Only the image
file based functionality will be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27667 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abb2df34 18-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* SymbolLookup: Implemented loading the symbol tables from the shared
object files. Thus static functions will be found, too.
* debug_lookup_symbol_address() and debug_next_image_symbol() no longer
need to read the symbol name via the debugger API, since the
respective SymbolLookup methods compute the length of the symbol name
that can safely be accessed locally, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27628 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb333098 17-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added work-around for a runtime loader problem after fork(). Its image
structures still have the parent IDs, so finding an image by ID would
fail in this case. We do now fall back to getting the image's text base
address and finding the image by address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27607 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 68e6763b 14-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added functionality for iterating through the symbols of a debugged
team's image to libdebug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27526 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9781d591 11-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Include <util/kernel_cpp.h> in DoublyLinkedList.h only when compiling
for the kernel. Added missing includes in userland code that uses the
header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20366 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 758b1d0e 12-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
Otherwise the an inner class with that name is considered as friend.
gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c085de40 18-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Corrected the note about static symbols.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13752 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a93b45f0 17-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Understood why static symbols are not found (we can't without reading the
concerned shared object's file, which probably is a bit overkill) and added
respective comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13725 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a323d35 16-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for looking up symbols of other team to libdebug. The
debug_server uses this feature to print stack traces with symbols.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13698 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 196ab88d06ca479b6d6ab2ab974c1dd0c899a088 30-Apr-2013 Rene Gollent <anevilyak@gmail.com>

Extend debug_create_symbol_lookup_context().

- debug_create_symbol_lookup_context() now takes an image ID
parameter that can optionally be used to restrict the symbols
it gathers to only those of the targeted image rather than the
entire team, allowing for significantly more lightweight usage
when the desired image is known. The previous behavior can still
be obtained if desired by passing -1 as said ID.

- Adjust callers.


# ffbf0328d29bc3ce8fe2a05bf2065d5c6676fc7c 20-Mar-2013 Pawel Dziepak <pdziepak@quarnos.org>

debug: update debug kit to correctly recognize commpage


# c0166cf22a42fd1e778fff49d4243865da4c22d6 09-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Should check for ELF_CLASS, not ELFCLASS32.


# a731ad19e680a5ec387be3e4345445cadcd75fb4 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

ELF64 and x86_64 support in the debug kit.


# 6e2f6d1ace7490a200dcff70c52acf2af59c5bc3 29-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Changed cookie type for get_next_area_info() to ssize_t.

The cookie is used to store the base address of the area that was just
visited. On 64-bit systems, int32 is not sufficient. Therefore, changed
to ssize_t which retains compatibility on x86 while expanding to a
sufficient size on x86_64.


# 9774f385b5b79b1128c47b270f9c9ec54fc1cd90 03-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added debug_get_symbol(). It's not implemented particularly efficiently, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31392 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39df634176f68a4089804907c54ce20300a9d88d 15-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added debug_get_symbol_iterator_image_info() to get an image_info from a
symbol iterator.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30168 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73677f785acf3360a0194dbd2d243fa9d56c9782 12-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Some refactoring: There are three ways to access the symbols of an image.
Formerly two were implemented in ImageFile (from file, via syscalls) and one
in SymbolLookup (via the debugger interface). Now there's a base class Image
and respective derived classes implementing those methods.
* Simplified SymbolIterator.
* Moved the classes into sub-namespace BPrivate::Debug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30142 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 366f546e676b06beeb3ba5baf0c34f2365804a0a 28-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Don't fail when the runtime loader debug area can't be found. When we
can load the image files, we can still do symbol lookups just fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27774 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 95d4a71d8974c9b6e30cf886ecc16d30657b94dc 23-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Rather use MAP_PRIVATE instead of MAP_SHARED. It doesn't make a
difference ATM, but will, when we change the semantics of MAP_PRIVATE to
imply MAP_COPY.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27714 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0be39a3a0db8333e609e12392e064f8e9fa63ddd 22-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Rather use the new _kern_read_kernel_image_symbols() syscall to use
kernel image symbol tables.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27688 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ada326834bed8264812b4ff99ce5ac2ec7f5567 21-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Also store the string table size for an image. This helps to improve the
symbol name len check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d8b24b47e3f63a59d13d5585eca491c4e1c6d965 21-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Made SymbolLookup safe to be used for the kernel team. Only the image
file based functionality will be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27667 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abb2df34ee5bc3fbb3f47fae3f7969dfe4126348 18-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* SymbolLookup: Implemented loading the symbol tables from the shared
object files. Thus static functions will be found, too.
* debug_lookup_symbol_address() and debug_next_image_symbol() no longer
need to read the symbol name via the debugger API, since the
respective SymbolLookup methods compute the length of the symbol name
that can safely be accessed locally, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27628 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eb333098fe361d36e330fe35707a75a21b18686f 17-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added work-around for a runtime loader problem after fork(). Its image
structures still have the parent IDs, so finding an image by ID would
fail in this case. We do now fall back to getting the image's text base
address and finding the image by address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27607 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 68e6763b074c48a3e3302b2162031c71110abe51 14-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added functionality for iterating through the symbols of a debugged
team's image to libdebug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27526 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9781d591cb022992380e8a98db7639f91f9bb93c 11-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Include <util/kernel_cpp.h> in DoublyLinkedList.h only when compiling
for the kernel. Added missing includes in userland code that uses the
header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20366 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 758b1d0e05fe1042cce6e00d194a147802d4f9be 12-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
Otherwise the an inner class with that name is considered as friend.
gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c085de40db21e8b7350cb569be663c22e09535ab 18-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Corrected the note about static symbols.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13752 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a93b45f00fbef37751ca3746bcf54c58b9fcaf23 17-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Understood why static symbols are not found (we can't without reading the
concerned shared object's file, which probably is a bit overkill) and added
respective comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13725 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9a323d3533ed56555d16790d139f139e35b82a1f 16-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for looking up symbols of other team to libdebug. The
debug_server uses this feature to print stack traces with symbols.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13698 a95241bf-73f2-0310-859d-f6bbb57e9c96