Vous êtes sur la page 1sur 40

Assaying the Hidden

Debugging Gems in
Cincom Smalltalk
A review and demonstrations of some of
the lesser-known debugging aids that are World Headquarters
Cincinnati, Ohio
available in Cincom ObjectStudio®,
VisualWorks®, and WebVelocity™.

Welcome
March 16, 2011

Wednesday, March 16, 2011


Documentation (dak´yəә məәn tā´ shəәn)

• ObjectStudio User's Guide - Chapter 7. Debugging


• VisualWorks Application Developer's Guide - Chapter
16. Debugging Techniques
• WebVelocity 1.1 ▸ Application
Development ▸ Debugging

☑ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
File Browser

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
File Browser
Tabs
• Binary tab
• Formatted Source
• Incorrect XML will truncate the source that is displayed.
• XML Tree
• Incorrect XML will leave the source code pane blank.
• File Information

“View ➜ Zoom” menu item or


Status Bar supports select and copy

Examples used: HttpPageAnalyzer.st, HttpPageAnalyzer_broken_test.st

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Memory Monitor

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Memory Monitor
Buttons

• IGC - ObjectMemory class>>quickGC


• GC - ObjectMemory class>>garbageCollect
• GGC - ObjectMemory class>>globalGarbageCollect
• FNS - Primitive 322 - Flush newSpace if possible,
tenuring everything.

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Memory Monitor
Buttons

• MAP - Toggle start/stop Profiling of the


MultiAllocationProfiler
The MultiAllocationProfiler is part of the AT Profiling UI
 In the Parcel Manager: "Developer Tools" folder.
 ...\advanced\ATProfilingUI.pcl

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Memory Monitor
Buttons

• LOG - Toggle Memory Monitor logging to a file


The filename has the pattern of
 filename - memoryMonitor[Timestamp now asSeconds].[cvs]
or [log]

If you want to enable verbose logging, change


MemoryMonitor>>useCSVLog so that it always returns
false.
Verbose logging will have the [log] file extension.

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Memory Monitor

• Before using, please read the VisualWorks Memory


Management Technical Note
 ...\doc\TechNotes\vwMemoryMgmt.pdf

• Loaded from
 ...\contributed\MemoryMonitor.pcl

• It can run in Headless images using


 MemoryMonitor class>>runHeadless
 MemoryMonitor class>>runHeadlessAtPriority:

• Presentation at Smalltalks 2010:


• VisualWorks Object Memory Management

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Debugger Tips
Watches

• “Insert Probe ➜ Variable Watch” menu item


• “Insert Probe ➜ Expression Watch” menu item
• “Insert Probe ➜ Window Parameters” menu item
 (all of the above have an option for operating conditionally)

• Screencasts:
• Variable Watches in the Debugger
• Probes and Watches in the Debugger
• Managing Watch Windows
• Expression Watches in the Debugger

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Debugger Tips
Class Probes

• ObjectStudio User's Guide - Chapter 7. Debugging,


Page 266
• VisualWorks Application Developer's Guide - Chapter
16. Debugging Techniques, page 13
“The Class ➜ Add Class Probe command allows you to insert
probes into several methods in a single operation. The probes
share any conditional expression and any watch expression, thus
allowing a single watch expression or conditional breakpoint to be
used for several methods. However, once inserted, the expressions
become independent, so if an expression is later modified, the
change applies only to the one probe.”

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Debugger Tips
Recompile with Full Blocks

The “Method ➜ Recompile with Full Blocks” menu item


recompiles the method so that all the blocks are full
blocks.
• ObjectStudio User's Guide - Chapter 7. Debugging,
Page 210
• VisualWorks Application Developer's Guide - Chapter
16. Debugging Techniques, page 29.

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Debugger Tips
Copy Stack Report

The “Stack ➜ Copy Stack Report” menu item puts a copy


of the debugger stack and information from each stack
frame onto the clipboard.
Can be useful when you need a quick text review of the
state of the current problem, or if you want to share the
information with someone else on your team, or with a
member of the Cincom Support team.

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Benchmarking Framework

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Benchmarking Framework
“The Benchmarking application provides an interface that
allows you to track each chunk of code (the code
between Benchmark class>>begin: and Benchmark
class>>end statements) as it executes.”
 ObjectStudio Mapping Tool User’s Guide - Chapter 6.
Benchmarking

• In ObjectStudio, it can be loaded using the “File ➜


Load application...” dialog box.
• In VisualWorks, you will need to copy the parcel or load
it from an ObjectStudio install:
 ...\ObjectStudio\parcels\ObjectStudio Benchmark Framework.*

• Won’t work in Headless images


Examples used: BenchmarkingTest.store

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Communications Logging Tool

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Communications Logging Tool
“NetClients components register themselves with the
Logging Tool when they are loaded. The Logging menu
lists all of the protocols currently registered. The
submenus provide options for which messages to log. To
add a message set, select it. Selected message sets are
marked with a check mark.”
 Internet Client Developer’s Guide - Chapter 1. Introduction to
Net Clients, Page 1-4.

• Pre-loaded in ObjectStudio
• In VisualWorks it can be loaded from
 ...\parcels\LoggingTool.pcl

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Communications Logging Tool

• Can be opened from a Workspace by executing:


 Core.LoggingTool open.

• Pick the networking protocols you wish to have logged


via the “Logging” menu.
• Start the logging with “Trace ➜ Trace on” menu item.
• Logs can be saved to an external file via “File ➜ Save
Output...” menu item.
• Like the Benchmark Explorer, this cannot be used in a
headless image.

Examples used: BenchmarkingTest.store

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Transcript
Debugging it old school

Out - anObject out


Shows the printString of an object on the Transcript
• Started in ObjectStudio, and is pre-loaded there
• Available in VisualWorks via the Out parcel
 ...\contributed\Out.pcl

• Can be available in WebVelocity if the Out parcel is


copied to the “contributed” directory of the WebVelocity
installation
Examples used: TemperatureConverterApp

☑ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
Transcript
Debugging it old school

SQL tracing to the Transcript window


• Change Glorp.DatabaseAccessor logging to always
return true.
 LogAllGlorpSQLTransations.pcl

• In ObjectStudio, it can also be activated via the


Mapping Tool
 Right-click on any table node in the Tables tree view and
select the “Set logging on” menu item from the context pop-up
menu.

Examples used: TemperatureConverterApp

☑ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
Transcript
Saving the Transcript output

-transcript filename "Mirror the transcript to a file"


 <oe> [oe_options] <image-name> [image_options]
[user_options]

• ObjectStudio
 Saving all the Transcript output
• <path>\ObjectStudio.exe objectstudio.im -transcript "<path>
\log.txt"
 The results of >>out only
• <path>\ObjectStudio.exe objectstudio.im –ostudio "-
o'\C:ProgramData\Cincom\ObjectStudio8.3\Test Space
\log.txt'"

☑ObjectStudio VisualWorks WebVelocity


Wednesday, March 16, 2011
Transcript
Saving the Transcript output

-transcript filename "Mirror the transcript to a file"


 <oe> [oe_options] <image-name> [image_options]
[user_options]

• VisualWorks and WebVelocity


 <path>\vwnt.exe visual.im -transcript "<path>\log.txt"

Examples used: TemperatureConverterApp

ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
Spy Tool
• “...[Y]ou would want a tool that can watch and report on
message sends, together with their parameters and points
of origination, without interfering with the flow of messages.
This tool is the Spy Tool. It is similar in concept to the
Microsoft® Spy++ tool with which Windows API
programmers are familiar.”
 ObjectStudio Users Guide - Chapter 7. Debugging - Page 214.

• In ObjectStudio select “File ➜ Load application...”


menu item then scroll to and select "Spy Tool" and
press “Load“ button.
• In VisualWorks you will need to copy the parcel or load
it from an ObjectStudio install:
• ...\parcels\contributed\Spy Tool.*
Examples used: Sample Browser ➜ Buttons ➜ Button Example

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Spy Tool
limitations

• For performance and other reasons, not all methods


can be spied. The list of exclusions can be found in two
places in the image:
 Refactory.Wrappers.SpyMethodWrapper.SelectorsToExclude
 MethodWrapper class>>canWrap: inClass:

• As a general rule, the Object class should not be spied


because the results would be too large to be useful.
• Like the Communications Logging Tool, this cannot be
used in a headless image.

Examples used: Sample Browser ➜ Buttons ➜ Button Example

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
VM Command Line Options
• -xq
 Save stack dump on normal or error exit. Includes stack traces
of all active Smalltalk processes and the state of the object
memory.

• -v
 Display engine and image version information.

• -o10s
 This logs every method translation (a first time method send)
to stdout during its whole runtime, which is then redirected to
the log.txt file in the example above. The results can be useful,
but the resulting file will be very large. This option does not
depend upon whether the image dies or not.

• -o...
 Various options to a debug version of the VM

☑ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
VM Command Line Options

• For other options see:


 Application Developer’s Guide - Appendix C. Virtual Machines,
Pages C-3 through C-6

• Screencast:
 VM Command Line Options

☑ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
VM Command Line Options
ObjectStudio

• <oe> [oe_options] <image-name> [image_options]


[user_options]
 <path>\ObjectStudio.exe objectstudio.im –ostudio "-
o'\C:ProgramData\Cincom\ObjectStudio8.2.1\Test Space
\log.txt'"

• Many of the options are similar to those for


VisualWorks and WebVelocity, and a list of the
ObjectStudio options can be found in:
 ObjectStudio User’s Guide - Chaper 1. Starting to use
ObjectStudio, Object Engine command-line options, Pages 20
through 21

☑ObjectStudio VisualWorks WebVelocity


Wednesday, March 16, 2011
Image Command Line Options
VisualWorks and WebVelocity

• -err filename
 Redirect any stack dumps to the listed filename

• For other options see:


 Application Developer’s Guide - Chapter 1. The VisualWorks
Environment - Launch from command line, Pages 1-3 through
1-5

• Screencast:
 Image Level Command Line Arguments

ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
Image Command Line Options
ObjectStudio

• <oe> [oe_options] <image-name> [image_options]


[user_options]
 <path>\ObjectStudio.exe objectstudio.im –ostudio "-
o'\C:ProgramData\Cincom\ObjectStudio8.2.1\Test Space
\log.txt'"

• Many of the options are similar to those for


VisualWorks and WebVelocity, and list of the
ObjectStudio options can be found in:
 ObjectStudio User’s Guide - Chaper 1. Starting to use
ObjectStudio, Image Level command-line options, Pages 22
through 23

☑ObjectStudio VisualWorks WebVelocity


Wednesday, March 16, 2011
Others

• Operating system display zooming


 Helps with complicated UI creation and small widget
placements
• MacOS X: “System Preferences ➜ Universal Access ➜ Zoom”
• Windows XP: “Start ➜ Accessories ➜ Accessibility ➜ Magnifier”

• Status bar Copy / Paste


• ProgrammingExtensions
 Adds “Inspect Window” and “Inspect Widget” context window
menu items
 In the Parcel Manager: “Developer Tools” folder
 ...\contributed\ProgrammingExtensions.pcl

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Others

• Tools-StartupOrderingTool
 Shows a graphical representation in a code browser tab for a
subsystem's position in the startup sequence.
 In the Parcel Manager: “Developer Tools” folder.
 ...\parcels\Tools-StartupOrderingTool.pcl

• Problems with method compilation?


 RBCodeHighlighting
• In the Parcel Manager: “Popular” folder.
• ..\contributed\RBCodeHighlighting.pcl
 RBBytecodeTool
• In the Parcel Manager: “Browser Extensions” folder.
• ..\contributed\RBBytecodeTool.pcl

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Others

• Problems finding code?


 SearchlightTools
• In the Parcel Manager: “Popular” folder.
• ..\contributed\SearchlightTools.pcl
 RBRegexExtensions
• In the Parcel Manager: “Browser Extensions” folder.
• ..\contributed\RBRegexExtensions.pcl

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Others

• Problems finding code in ObjectStudio?


 Select “Tools ➜ String Finder...” menu item
• It only searches in code. It will not find strings in comments.
• If you are running XP under Parallels, and you are using the “Mac Look”,
you will need to change ObjectStudio.GlobalDictionary>>hasXPView, to
always return true.
 RBRegexExtensions
• In the Parcel Manager: “Browser Extensions” folder.
• ..\contributed\RBRegexExtensions.pcl

☑ObjectStudio VisualWorks WebVelocity


Wednesday, March 16, 2011
Others

• Problems with headless images?


 HeadlessImage default becomeHeadfull.
 Applications Developers Guide - Chapter 20. Creating an
Application without a GUI
 Screencasts about headless images

ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
Others

• Need to log stack dumps during a process, or you can’t


get a debugger to pop-up?
 VerboseProcessDump
 VerboseLogReader
• Cincom Public Repository

☑ObjectStudio ☑VisualWorks WebVelocity


Wednesday, March 16, 2011
Others
• VisualWorks Examples
 In the Parcel Manager: “Directories” tab ➜ “Examples” folder.

• ObjectStudio Examples
 “File ➜ Load Application...”, “Sample Browser”

• Cincom’s collection of various Smalltalk videos and


screencasts
 Smalltalk Daily
 Smalltalk Videos

• Toothpick - A simple, configurable logging mechanism


for Smalltalk
 Cincom Public Repository
 Toothpick’s Website

☑ObjectStudio ☑VisualWorks ☑WebVelocity


Wednesday, March 16, 2011
Who is Poly and why does she keep
changing?

Q
&
A
☑ObjectStudio ☑VisualWorks ☑WebVelocity
Wednesday, March 16, 2011
Contact info

• Star Team (Smalltalk Strategic Resources)


 sfortman@cincom.com Smalltalk Program Director
 athomas@cincom.com Smalltalk Product Manager
 jjordan@cincom.com Smalltalk Marketing Manager

• http://www.cincomsmalltalk.com

Wednesday, March 16, 2011


Wednesday, March 16, 2011
© 2011 Cincom Systems, Inc.
All Rights Reserved
Developed in the U.S.A.

CINCOM and the Quadrant Logo are registered trademarks of Cincom Systems, Inc.
All other trademarks belong to their respective companies.

Wednesday, March 16, 2011

Vous aimerez peut-être aussi