75 Commits

Author SHA1 Message Date
Philippe Houdoin
1a90a58f48 Reuse KDL demangler module demangle_symbol() and get_next_argument() to
improve userland Debugger arguments demangling support: 
now with argument name and/or type, when available.

I hope I didn't break coding guideline doing so.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-25 22:49:07 +00:00
Philippe Houdoin
3b11679508 Add gcc2 demangling.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-25 07:58:51 +00:00
Ingo Weinhold
823e8a80f7 Recognize non-frameless functions and deal with situations where the instruction
pointer is before/in the prologue or after the epilogue. No solution for
frameless functions yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 23:38:29 +00:00
Ingo Weinhold
2460bf468b * Changes that should already have been part of r31228: StackFrame and
SourceView.
* Fixed the information flow problem in Architecture::CreateStackTrace()/
  ArchitectureX86::UpdateStackCpuState() by introducing a virtual
  UpdateStackFrameCpuState() which allows the architecture to update the CPU
  state it generated before after the function the state belongs to is known.
  That's where moving the instruction pointer to the previous instruction
  happens now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 22:10:07 +00:00
Ingo Weinhold
840c76534f * Added StackFrame classification as syscall frame and added correct
identification for x86.
* For non-top stack frames adjust the instruction pointer so that it points to
  the calling function instead of the return address.
* SourceView: Consider a syscall frame a non-top frame (the arrow is drawn
  differently).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 16:37:11 +00:00
Ingo Weinhold
ed832ef623 Correctly unset the objects we know. We don't only need to release the
references to them, but also unregister as listener.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31225 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 12:36:14 +00:00
Ingo Weinhold
9a6d65aaed Quit the window on destruction.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31224 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 12:34:48 +00:00
Ingo Weinhold
194b3b719a * Moved all handling of threads from TeamDebugger into new class ThreadHandler.
* Added new job to get the initial state of a thread.
* Now we also get the states of new threads correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31221 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 01:46:38 +00:00
Ingo Weinhold
74558e1c42 Renamed the "Stop" button to "Debug" to avoid confusion.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31220 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 00:25:21 +00:00
Ingo Weinhold
719f89b06e Fixed the application quit mechanism. Due to the two levels of asynchronous
message sending the main thread exit()ed before the team debugger could process
its quit message. We're no longer taking the detour via Debugger when quitting
a window. The team debugger just quits and synchronously notifies the
application, which in turn waits until all team debugger threads have gone.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31219 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 00:16:22 +00:00
Ingo Weinhold
fef6a27d78 * Moved killing/resuming the team to DebuggerInterface::Close().
* Made the TeamDebugger safer for the case that the initialization failed early.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31218 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 23:09:36 +00:00
Ingo Weinhold
e951f678c2 Moved message code where it belongs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31217 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 22:29:15 +00:00
Stephan Aßmus
4922427769 Implement killing the debugged team on quitting a TeamDebugger, the obviuos
way... thanks Ingo! Seems to work just fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31204 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 13:09:50 +00:00
Stephan Aßmus
b9563a6fd9 Added NOTE on how to handle QuitRequested in the application and why using
the base class version is fine for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 12:20:14 +00:00
Stephan Aßmus
04743aeb5f Filled up the quitting code path a bit. The TeamDebugger throws up an alert
asking what to do with the debugged team. Killing it is not yet implemented.
Then it notifies the application about the quit request. That in turn tears
down the TeamDebugger and if no other ones are left, it quits itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 12:14:05 +00:00
Stephan Aßmus
73b8cef5e6 Sorry for messing in this code, but I was a bit helpless how to fix the GCC2
build in another way...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31200 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 12:12:08 +00:00
Stephan Aßmus
b9bbf08852 Small cleanup
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 11:05:16 +00:00
Stephan Aßmus
e5a5e5da5a * Use auto-size-limits on the window.
* Use insets around everything. The visual change are insets also around the
  source code view. Another option would be to put the source code view on the
  right/bottom, attaching the window border and using a B_DOCUMENT_WINDOW
  resize knob on the window border. The register view could also use the
  additional height of the buttons. However, I agree it's somehow more logical
  to have the register view on the right side. Maybe only because of
  convention... so it's possibly still up for debate.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31198 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-23 11:04:38 +00:00
Ingo Weinhold
6381d6cc4e * Added Breakpoint class and extended TeamDebugModel to manage the objects.
Extended the event mechanism respectively.
* Added support to SourceView to display breakpoints and manipulate them.
* Extended TeamDebugger to install/uninstall breakpoints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31189 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 21:51:32 +00:00
Ingo Weinhold
7c439b2356 Added {Install,Uninstall}Breakpoint().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31188 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 21:44:09 +00:00
Stephan Aßmus
448ab012ef Created an icon for the Debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31176 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 09:04:02 +00:00
Ingo Weinhold
ce5d942c1a Uninlined the implementations of the inner classes. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31175 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 01:30:55 +00:00
Ingo Weinhold
7367310fbe * Virtualized SourceCode and implemented a derived class DisassembledCode, which
allows to implement StatementAtAddress() in O(log(n).
* Added SourceCode::StatementAtLine().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31174 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 01:13:57 +00:00
Ingo Weinhold
21821017e7 Added ContiguousStatement::AddressRange() for cheaper address range access.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31173 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 01:09:26 +00:00
Ingo Weinhold
704e25ea2d Removed dead code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31172 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 01:08:44 +00:00
Ingo Weinhold
faa04e8d93 Also return the "commpage" image as one of the team's images.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31171 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 00:07:13 +00:00
Ingo Weinhold
ede842bb1d * SourceView can now show markers for stack frame instruction pointers.
Furthermore it automatically scrolls to the current IP of the currently
  selected stack frame.
* TeamWindow:
  - Be lazy setting the SourceCode, i.e. as long as no other source shall be
    shown (e.g. another stack frame is selected) we keep the previous one.
  - When a new stack strace is set, automatically select the top-most frame.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31170 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 23:44:18 +00:00
Ingo Weinhold
49ad0141cf Added StatementAtAddress() returning the statement at a given target address.
Needs optimization (iterates through all statements ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31169 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 23:30:18 +00:00
Ingo Weinhold
1df9bf1220 Added Statement::ContainsAddress().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31168 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 23:28:13 +00:00
Ingo Weinhold
470c2c49a9 Passed incorrect instruction size to Statement constructor.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31167 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 23:27:33 +00:00
Ingo Weinhold
0bcacd22ab * Added classes to represent source code (SourceCode, Statement).
* Added x86 disassembler (via libudis86).
* Added Architecture::DisassembleCode() to disassemble a function to SourceCode.
* Added virtual DebugInfo::LoadSourceCode() to retrieve the source code for a
  given function. The implementation in DebuggerDebugInfo disassembles the
  function.
* Added source code info to StackFrame. Also added a listener mechanism to get
  notified on source code changes.
* Added job to load the source code for a stack frame.
* Added (very basic) source code view and wired everything so that when a stack
  frame is selected the source code (respectively disassembly) for the
  underlying function is retrieved and shown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 13:17:21 +00:00
Ingo Weinhold
a0a50d370e * Missing initialization of fStackTrace.
* Removed unnecessary TableRowInvoked().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31156 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 13:03:08 +00:00
Stephan Aßmus
a560ab791b * Create the BColumnListViews with fancy borders.
* Add some spacing around most views in the top level layout.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 12:07:11 +00:00
Ingo Weinhold
c3edfca6e4 * If a stack frame is selected show its registers instead those of the top
frame.
* Some cleanup in ThreadListView.
* Unregister view listeners in the window destructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31147 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 19:26:47 +00:00
Ingo Weinhold
cba4143217 Added demangling support. Only implemented for gcc 4 yet.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31146 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 18:45:20 +00:00
Ingo Weinhold
c9fc1d5064 Moved several classes into new "model" subdir.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31143 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 18:17:48 +00:00
Ingo Weinhold
0b60fa86e9 * Added DebuggerInterface::GetSymbolInfos() to get the symbols for an image.
* Added the beginnings of the debug info abstraction. Currently we can only load
  the symbols via the debugger.
* Added a job to retrieve debug info for an image. Extended the GetStackTraceJob
  to support waiting for image debug info to be loaded.
* Extended ImageInfo by text/data address and size.
* Removed StackFrameX86 and made StackFrame a simple non-polymorphic class
  featuring all the needed data. The really architecture-dependent is in the
  referenced CpuState already. Added Image* and FunctionDebugInfo* attributes,
  referring to the image respectively debug info for the function hit by the
  instruction pointer.
* Switched StrackTrace's StackFrame management from DoublyLinkedList to
  BObjectList. This makes it more comfortable to use.
* Changed the code for creating stack traces:
  - The creation of the StackTrace object and the main loop to collect the
    frames are now located in the no longer virtual
    Architecture::CreateStackTrace().
  - The decision how to create a StackFrame is based on the instruction pointer.
    If it hit a function for which debug info is available, the respective
    DebugInfo::CreateStackFrame() is used, otherwise we fall back to the new
    virtual Architecture::CreateStackFrame().
* Adjusted the stack trace view to also show function names (mangled ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31142 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 17:20:49 +00:00
Ingo Weinhold
8b5ee1118a Added Worker::GetJob() to get a known job by key.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31141 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 16:49:31 +00:00
Philippe Houdoin
ec1b789c2e DebuggerInterface destructor wasn't virtual, raising a -Werror warning.
Fixed libdebug.so link.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31129 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 08:52:51 +00:00
Ingo Weinhold
b7c5bd634b Renamed Variant to BVariant and moved it to libshared.a.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 23:00:25 +00:00
Ingo Weinhold
15f040e596 Some work towards getting stack traces:
* Added a virtual Architecture::CreateStackTrace() and added a basic
  implementation in ArchitectureX86. Fleshed out StackTrace/StackFrame a bit
  and added StackFrameX86. This needs to be organized differently, though, so
  that we can get the maximum available information for each stack frame,
  depending on what info is available for the respective function.
* Added job to get the stack trace for a thread.
* Added stack trace related handling in TeamDebugger. Reorganized the thread
  state/CPU state/stack trace change handling a bit -- we're using a
  Team::Listener now, and do things asynchronously.
* Added a StackTraceView to display the stack trace of the current thread. No
  function name available yet, otherwise working fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31126 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 22:13:32 +00:00
Ingo Weinhold
1ae2cffc83 Added ReadMemory().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31125 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 21:58:48 +00:00
Ingo Weinhold
15b6b23934 Added view to show registers. Doesn't look particularly nice, but seems to work.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31122 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 17:31:24 +00:00
Ingo Weinhold
8c724eb86c We already have a reference and want to get rid of it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31121 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 17:29:39 +00:00
Ingo Weinhold
2a3974d313 Added constructor versions of the Group and Grid layout builders that take a
BWindow* parameter. They set the newly created layout on the window, which saves
the API user to do that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31118 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 15:28:00 +00:00
Ingo Weinhold
6383ae9c30 Added Architecture and DebuggerInterface to the TeamDebugModel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 15:17:58 +00:00
Ingo Weinhold
495676cab6 * Implemented Worker class, which executes Jobs in a separate thread.
* Implemented a job for getting a thread's CPU state.
* The team debugger uses a worker now. ATM only for getting the CPU state for
  stopped threads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31116 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 15:09:56 +00:00
Ingo Weinhold
c42fe1eb57 More work on the architecture abstraction, particularly regarding information
about what registers the architecture has and how to get them from the CpuState.
Implemented the respective x86 part.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31109 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-19 00:05:45 +00:00
Ingo Weinhold
3c4cb05b95 We can't only use a single debug context, if we want to allow multiple threads
to play with us without blocking. Implemented a pool of debug contexts instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31108 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-18 22:37:16 +00:00
Ingo Weinhold
b6aff5aa83 * Added notifications for thread state/CPU state/stack trace changes. The team
window listens for those and updates the buttons correctly.
* Added basic handling for the thread stopping debug events in the team
  debugger.
* Forward the thread run/stop/step requests to the team debugger and actually
  run/stop/step the thread. Running/stopping works, all three stepping actions
  just step by a single instruction ATM, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31107 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-18 21:45:14 +00:00