Commit Graph

43 Commits

Author SHA1 Message Date
Rene Gollent
6997467eea Fix an instance where an allocation wasn't checked for success.
Wrap call to SymbolLookup::Init() in a try/catch block since it could
potentially throw an exception. This was causing the debugger to terminate
in some instances.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40046 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-31 17:17:19 +00:00
Rene Gollent
131e477eb9 Should have been part of previous commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39850 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-14 19:01:37 +00:00
Rene Gollent
68258fd9d0 Actually copy the data to be written into the message.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-14 13:16:44 +00:00
Rene Gollent
7040b50df5 Add support for thread rename and priority change notifications to the
debugger API/message set.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39846 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-14 05:08:47 +00:00
Rene Gollent
6cdfe5505c Add write counterparts to debug_read_memory/debug_read_memory_partial.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39843 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-13 23:27:59 +00:00
Ingo Weinhold
64d5a0a4b7 Added UnhandledDebugMessage() hook which is called by the base class
implementations of the other hooks. This way one can easily detect/handle
otherwise unhandled events.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35964 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-26 21:18:08 +00:00
Ingo Weinhold
1c421b8df4 Added optional "singleStep" parameter to ContinueThread().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35963 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-26 21:16:43 +00:00
Ingo Weinhold
53446ebf80 Added a few classes to the debug kit:
* BDebugMessageHandler: Interface with hooks for handling of debug messages.
* BDebugContext: Essentially a C++ wrapper for struct debug_context, with
  handy methods for controlling a debugged team.
* BTeamDebugger: Proxy for a debugged team. Derived from BDebugContext.
* BDebugLooper: Wraps a main debug message loop. Any number of BTeamDebuggers
  can be added and associated with BDebugMessageHandlers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-26 00:15:59 +00:00
Jonas Sundström
080f08465b Add stubbed out debug support functions for arch mipsel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-08-23 01:34:04 +00:00
Ingo Weinhold
86e89f1207 Added BDebugEventInputStream::Seek() to seek in the stream. Works for data
buffer based stream only ATM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 18:51:38 +00:00
Oliver Tappe
16d5c24e53 * merged 32bit-wchar_t branches of buildtools and haiku back into
the respective trunk

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31443 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-07 10:30:09 +00:00
Ingo Weinhold
9774f385b5 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
2009-07-03 14:20:27 +00:00
Ingo Weinhold
ef0ce69148 Added optional BDebugEventStream::ReadNextEvent() return parameter for the
stream position of the event header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30504 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-30 12:24:25 +00:00
Ingo Weinhold
0b6cffb656 Added BDebugEventInputStream::SetTo() for initializing with a memory buffer.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30295 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 15:29:11 +00:00
Ingo Weinhold
4d8d8c1f38 * Added a "reserved" field to the debug event file header to align it to 8
bytes.
* strlcpy() isn't a particularly good string compare function.
* BDebugEventInputStream::_GetData():
  - Also need to reset fBufferPosition to 0 when the buffer is empty.
  - Fixed read position.

BDebugEventInputStream does now actually read the files written by
BDebugEventOutputStream.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30273 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-19 23:44:20 +00:00
Ingo Weinhold
36e787103f Made BDebugEventInputStream::ReadNextEvent() nicer to use.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30260 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-19 11:17:24 +00:00
Ingo Weinhold
4db202f5f4 Defined a simple file format to store debug event streams as generated by the
system profiling interface and added classes BDebugEvent{Input,Ouput}Stream for
reading/writing those files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-18 17:38:21 +00:00
Ingo Weinhold
39df634176 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
2009-04-15 13:30:14 +00:00
Ingo Weinhold
e52c3559d3 * Renamed debug_delete_image_symbol_iterator() to
debug_delete_symbol_iterator().
* Added debug_create_file_symbol_iterator() which opens a shared object file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30162 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-14 18:03:24 +00:00
Ingo Weinhold
60dd191612 Removed the SymbolLookup dependency in debug_next_image_symbol().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-14 16:52:08 +00:00
Ingo Weinhold
73677f785a * 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
2009-04-12 23:57:35 +00:00
Ingo Weinhold
0f37915687 * debug_create_symbol_lookup_context() gets a team ID instead of a
debug context now. That's all it needs.
* Added the option "-a" to the profile command line tool. It triggers profiling
  of the whole system. There are still some issues, particularly image related
  ones.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30129 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-11 22:59:31 +00:00
Ingo Weinhold
366f546e67 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
2008-09-29 00:41:31 +00:00
Ingo Weinhold
95d4a71d89 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
2008-09-23 20:34:45 +00:00
Ingo Weinhold
0be39a3a0d 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
2008-09-22 11:17:30 +00:00
Ingo Weinhold
7ada326834 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
2008-09-21 23:38:46 +00:00
Ingo Weinhold
d8b24b47e3 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
2008-09-21 13:02:13 +00:00
Ingo Weinhold
abb2df34ee * 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
2008-09-18 22:17:11 +00:00
Ingo Weinhold
eb333098fe 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
2008-09-18 00:15:44 +00:00
Ingo Weinhold
68e6763b07 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
2008-09-15 12:47:59 +00:00
François Revol
f57b802a6e Debugger stubs for m68k.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25922 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-11 01:26:02 +00:00
Ingo Weinhold
6b202f4e3d * Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
  several kernel headers into a shared part and one that is still kernel
  private. Adjusted all affected Jamfiles and source in the standard x86
  build accordingly. The build for other architectures and for test code
  may be broken.
* Quite a bit of userland code still includes private kernel headers.
  Mostly those are <util/*> headers. The ones that aren't strictly
  kernel-only should be moved to some other place (maybe
  headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-14 03:55:16 +00:00
Stephan Aßmus
28ff3e2c9a * the name of an image is actually B_PATH_NAME_LENGTH long
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23707 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-23 14:58:24 +00:00
Ingo Weinhold
9781d591cb 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
2007-03-11 13:56:45 +00:00
Ingo Weinhold
27de84142b Empty implementations of PPC stack trace functions to make the build
system happy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15476 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-10 20:17:49 +00:00
Ingo Weinhold
758b1d0e05 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
2005-11-12 23:27:14 +00:00
Ingo Weinhold
338b8dc301 Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-29 16:27:43 +00:00
Ingo Weinhold
a79265708d Set the members of a destroyed debug_context to invalid values.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13774 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-19 23:14:16 +00:00
Ingo Weinhold
c085de40db Corrected the note about static symbols.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13752 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-18 15:20:35 +00:00
Ingo Weinhold
a93b45f00f 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
2005-07-17 23:44:43 +00:00
Ingo Weinhold
9a323d3533 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
2005-07-16 21:12:32 +00:00
Axel Dörfler
b2c1ecd640 Added patch originally written by Ingo Weinhold:
- extended libdebug.so functionality to be able to get stack frames,
  current instruction pointer, etc.
- changed the debug_server to be able to run as a simple BLooper - this
  saves some trouble when the app_server dies
- the debug_server now prints out a stack crawl for the crashed team
  (without symbols, though - for that data to be helpful you should
  have a look at the loaded images (ie. where they start))
- the debug_server now also prints the team name when it kills it


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12882 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-29 00:44:51 +00:00
Ingo Weinhold
0a064776ae Added the beginnings of a small private API for debug support.
Entirely implemented on top of the public <debugger.h> API, but more
convenient to use. Lives in a separate library libdebug.so.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11925 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-20 22:04:04 +00:00