[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document discusses changes to GDB and Insight that will allow the debugging of unified memory, asymetric, multi-threaded targets.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Between Insight and GDB, the following layers and interfaces can be identified:
The next chapter provides a brief review of multi-arch and what it means in the current context.
Follow that, succeeding chapters address each of the above layers and interfaces discussing the intended changes. At each stage, the emphasis of the document is on the interfaces rather than the details of the internal changes.
This document refers to multi-threaded targets. Such a target has multiple execution units. Those execution units could equally be pthreads or processors.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The original GDB release included a number of architectural restrictions. In particular, GDB was was only capable of debugging:
Each of these can be viewed as largely orthogonal:
The elimination of these restrictions is a long term objective of GDB.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As GDB has evolved, some of these restrictions have been partially addressed. In particular:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The objective of this document is to address the restrictions that limit GDB's ability to debug multi-threaded targets where each thread can have a different instruction set architecture.
The restriction that GDB can not debug targets with multiple address spaces has not being addressed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The current Insight interface provides a number of mechanisms for examining the target's state. At any time, each of these mechanisms is providing a differeing view of a single thread (current thread) and one of its frame (current frame).
The Source and Control window displays the source source (and assembler) for the current threads, current frame.
In addition, the Source and Control window provide:
The local variable window provides a way of examing the local variables found on the current thread's stack frame.
The memory window displays the contents of the current threads address space.
The register window displays the registers for the current thread's current frame.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Insight provides two mechanisms for changing the current target state being displayed by the Display Windows:
That navigation provides a mechanism for navigating allows the user to move within a two dimentional space:
At all times, there is only a single current thread and stack frame. Selecting a new thread or frame will update all display windows:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Insight provides the following mechanisms for changing the current thread and that threads stack frame.
The stack window provides a browserable list of the current threads stack frames. This can be used to change the current frame for the current thread.
The thread/process window provides a browserable list of the targets threads. This can be used to change the current thread (and hence the current stack).
Found on the source/control window, these buttons provide a mechanism for moving between the current threads stack frames.
The console window provides direct access to GDB's command line interpreter. The console window can be used to directly display and modify the target state.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following are also available.
The Function Browser Window allows the user to browse various source files. It does not affect the current thread or current stack frame.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The most significnat restriction in the existing Insight GUI interface its its inability to display more than one thread simultaneously. As noted above, at any time Insight only displays the current thread/frame.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To address the restriction of only a current thread/frame, it is proposed that Insight be modified so that all Display Windows include mechanims for selecting the thread/frame being displayed.
When either the thread or frame is explicitly set, the window is described as being navigated away from current. Once a Display Window has been navigated away from the current thread/frame, it is no longer affected by changes initiated by the Navigation Mechanims such as the Stack Window and Thread Window.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The thread menu, present on display windows, allows the user to specify that:
is displayed.
The Select Frame menu, present on display windows, allows the user to specify that the selected threads:
is displayed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The current Insight implementation, reflecting GDB's internals, is very single architecture, single thread, single frame centric. All display windows rely on global state and assume that that global state will rarely, if ever, change.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following structural changes have been identified.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Each display window needs to modified that it uses local state to determine what to display. In particular, each window will need to know its:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
So that Display Windows tracking the current thread, frame and architecture are kept synchronized, the event mechanism used by Insight will need to be extended to include the notifications:
When a user changes the current thread, frame or architecture, the change event would be broadcast so that all interested display windows would update accordingly.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The existing GDB / Insight interface assumes that there is only a single current architecture, thread and frame. Moving between architectures, threads and frames is an expensive (threads), if not impossible (architecture) operation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Reflecting the changes to both the GUI and Insights internals, the GDB/Insight interface will need to be extended to support:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The current GDB architecture is based around a single global state. That global state includes:
struct frame
struct gdbarch
struct thread_info
Because of the way the global state is managed (eg changing threads invalidates all frames) there are also certain implicit relationships between that global states components.
GDB uses this single global state to track the current thread. When ever a new thread is selected, the current state is discarded and a new state created. This behavour has serious consequences for GUI interfaces which expect to be both displaying multiple-thread states simultaneously and quickly and efficiently switching between threads.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The proposed change (discussed on GDB Discussion Mailing List) is to:
By giving each frame an explict architecture, GDB's restriction that there can only be a single global architecture is removed.
By making the thread-frame relationship explicit, there is no longer a need to discard all thread/frame information when switching threads.
By making the frame an explicit parameter, the need, by GUI's to constantly switch the current thread/frame is removed.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
GDB interacts with a remote target using the "GDB remote protocol". This protocol includes mechansims that allow GDB to obtain the current state of the target including:
Both GDB and the remote target assume the architecture of the current target.
The protocol uses target architecture dependant mechanisms when transfering registers.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The protocol needs to be extended so that the target can notify GDB of the archhitecture of the current thread.
The protocol may also need to be extended so that support a target independant representation of registers.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Below are draft changes to the remote protocol that address the above:
T00;...;Architecture=<arch>;...
T
packet is used to report the reason the target stopped to
GDB. That packet includes information such as the processor and that
processors registers. The packet can be extended to include the
architecture of the processor that halted.
qArchitecture
T
status packet, is to add an
architecture query packet to the protocol.
T00;...;<regnum>!<register-value>;...
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
1. Introduction
2. Single-memory, asymetric, multi-threaded GDB
3. User/Insight Interface (the GUI and GDB CLI).
4. Insight internals
5. Insight/GDB Interface
6. GDB internals
7. GDB/Remote Target Inteface
[Top] | [Contents] | [Index] | [ ? ] |
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | previous section in reading order | 1.2.2 |
[ > ] | Forward | next section in reading order | 1.2.4 |
[ << ] | FastBack | previous or up-and-previous section | 1.1 |
[ Up ] | Up | up section | 1.2 |
[ >> ] | FastForward | next or up-and-next section | 1.3 |
[Top] | Top | cover (top) of document | |
[Contents] | Contents | table of contents | |
[Index] | Index | concept index | |
[ ? ] | About | this page |