New in Delphi 2005: Modules View Enhancements
In Delphi 2005, the integrated debugger received many enhancements and new features. One such enhancement, improved call stacks, is mentioned in this previous blog post. Over the next few weeks, I’d like to present more details of a few more new Delphi debugger features in the form of blog posts.
To get the ball rolling, I’d like to start by pointing out some of the enhancements made to the debugger’s Modules View. The Modules View is displayed using the menu item: View | Debug Windows | Modules (Ctrl+Alt+M)
First, a little history
Prior to Delphi 8 and Delphi 2005, the Modules View hadn’t changed much since Delphi 4. It shows you a list of modules loaded by each executable that you are debugging (as mentioned here, it is a multi-process view). It will also show you a list of public entry points into a given module. Also, for modules which are built with debugging information, it shows you a list of source files used to build the module. One other feature provided by the Modules View is the ability to set Module Load Breakpoints, though this is only available when debugging native applications. In C#Builder 1 and Delphi 8 (the first versions of the IDE to support the .NET framework), the modules view was changed to show a runtime view of all the namespaces, classes, and methods available in your application. This runtime scope view replaced the entry point view, which no longer made sense in a managed world.
One other change made for the new IDE is that the Modules View is now embedded in the editor view. This change was made in order to give the Modules View a proper home in the new fully-docked IDE. The multi-pane layout of the Modules view really doesn’t lend itself very well to being a separate IDE view anymore.
Changes in Delphi 2005
First, let’s take a look at the modules view in Delphi 2005. The following images are referenced later in this post:
Figure 1: Modules View when debugging a managed process
Figure 2: Modules View when debugging a native process
- Polymorphic — Since the IDE now supports debugging both native and managed processes, we needed to unify the modules view so that it could deal with both types of processes. As I stated earlier, the major difference in the modules view when debugging native vs. managed processes is that the right hand pane shows very different information. For native debugging, the contents depend on the module selected in the main modules pane — it shows the list of entry points into that module. For managed debugging, it shows a runtime view of all the namespaces, classes and methods that are available to the process. In Delphi 2005, this right hand pane is polymorphic — it’s contents change based on what is selected in the main modules pane. If you select a module that is loaded by a native process, the right pane shows the entry point list for that module. If you select a module that is loaded by a managed process, the right pane shows the runtime scope view of that process. If you are debugging multiple processes (i.e one native and one managed), the right pane will morph from a listview of entry points to a treeview showing the runtime scope view, depending on which process or item is selected. Note the above images showing the Modules View. In both cases, two processes are loaded in the debugger, one managed and one native. In the first image, a managed process is selected in the main modules pane and the right pane shows the runtime scope view. In the second image, a module laoded by a native process is selected in the main modules pane and the right pane shows the list of entry points in that module.
- Sorting — The main modules pane now supports sorting. To sort the modules, simply click on one of the three column headers in the main modules pane. You can sort by Module Name, Module Base Address, or Module Path. By sorting by Module Name or Module Path, you can easily find a particular module when debugging a process that loads many modules. By sorting by Module Base Address, you can easily figure out which module a particular address lives in. This is handy when you receive a bug report referencing an access violation at a particular address, and you want to figure out which module that address lives in. Note that if you are debugging multiple processes, the list of modules is sorted for each process when you click a column header.
- Searching — Both the main modules pane and the right hand pane now support type-ahead imcremental searching. With focus in eather pane, you can now start typing a name you want to locate and that pane will focus the first item that matches the string you type in. This is handy when you want to locate a particular module, entry point, or item in the runtime scope view.
- Application Domains — When debugging managed processes, the main modules pane and the runtime scope pane now also show any Application Domains that are created by the application you are debugging. In Figure 1 above, you can see the default App Domain (called “DefaultDomain“) in both panes.
Notes:
- Much of the work done in the Modules View was made much easier by using the Virtual Tree View control. In fact the Virtual Tree View is now used in many places in the IDE, including the Project Manager, Structure Pane, Breakpoint View, Watch View, and Local Variables View. If you’re looking for a versatile, performant tree view control (that can also act as a replacement for a TListView), I strongly recommend this control.
- There are two issues with sorting that weren’t fixed for Delphi 2005. First, once you sort the view, there is no easy way to restore the original order of the modules. You may want to do this to analyze the module load order after having sorted the view. The workaround is to close and then reopen the Modules View. This will restore the original load order in the view. The second issue is that if you have sorted the view, any modules that get loaded after you sort will not appear sorted in the list. They will always appear at the end of the list. The workaround for this issue to to simply click the column header twice to re-sort the view. Both of these issues will be fixed in the next major Delphi release.
Share This | Email this page to a friend
Posted by Chris Hesik on March 23rd, 2005 under CodeGear Debugger |

RSS Feed

March 23rd, 2005 at 7:41 pm
Sounds great. What I would like to do is placing a breakpoint on any of the entry points (native) or methods (managed) by clicking it in the modules view, or going to the method/entry point.
Can this be done currently?
March 23rd, 2005 at 11:53 pm
Great to read what’s comming up in the next version. I love the Module View
However, point three to take into the next version would be persistency for my sorting-selection, iow it should be saved with the layout (now, that we will be able to select the original order as well).
Sincerely,
Daniel
March 24th, 2005 at 8:17 am
Chee Wee,
Currently there is no breakpoint integration in the modules view’s right hand pane, though this is something that is currently on the todo list for a future version. You can, however, navigate from that pane using the context menu or by simply double-clicking. Once you have navigated to the location (in either source or disassembly), you can set a breakpoint there.
March 24th, 2005 at 8:23 am
Daniel,
I agree, we should persist the sort column and sort direction with the modules view layout. I’ll add this item to the todo list as well.