assaying the hidden debugging gems in cincom smalltalk - james savidge

40
Welcome March 16, 2011 World Headquarters Cincinnati, Ohio Assaying the Hidden Debugging Gems in Cincom Smalltalk A review and demonstrations of some of the lesser-known debugging aids that are available in Cincom ObjectStudio ® , VisualWorks ® , and WebVelocity™. Wednesday, March 16, 2011

Upload: smalltalk-solutions

Post on 28-Mar-2015

526 views

Category:

Documents


6 download

DESCRIPTION

The Debugger is the diamond-tipped blade in the debugging toolset for VisualWorks, ObjectStudio, and WebVelocity. Unfortunately, not all bugs can be fixed by cutting them into smaller pieces. It is in these cases where some of the unknown and lesser-known debugging tools have an opportunity to shine. The need for these alternative tools becomes apparent when the bug may be related to user interface problems, is infrequent, or is timing-related. In this presentation, I will describe some of unknown and lesser-known debugging gems, such as the communications LoggingTool, the MemoryMonitor, the upcoming system-wide Spy tool, and several others, some difficult to find. I will describe where to find these tools, what problems they are best suited for, and I will give brief demonstrations of how they can be used. This assay will provide a guide to the debugging toolsets that, up until now, may have gone unnoticed by many users of the three Cincom Smalltalk products.

TRANSCRIPT

Page 1: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Welcome March 16, 2011

World HeadquartersCincinnati, Ohio

Assaying the Hidden Debugging Gems in Cincom Smalltalk

A review and demonstrations of some of the lesser-known debugging aids that are

available in Cincom ObjectStudio®, VisualWorks®, and WebVelocity™.

Wednesday, March 16, 2011

Page 2: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 3: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

File Browser

☑ObjectStudio ☑VisualWorks WebVelocity

Wednesday, March 16, 2011

Page 4: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

File BrowserTabs

• 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

☑ObjectStudio ☑VisualWorks WebVelocity

Examples used: HttpPageAnalyzer.st, HttpPageAnalyzer_broken_test.st

Wednesday, March 16, 2011

Page 5: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Memory Monitor

☑ObjectStudio ☑VisualWorks WebVelocity

Wednesday, March 16, 2011

Page 6: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

• IGC - ObjectMemory class>>quickGC

• GC - ObjectMemory class>>garbageCollect

• GGC - ObjectMemory class>>globalGarbageCollect

• FNS - Primitive 322 - Flush newSpace if possible, tenuring everything.

☑ObjectStudio ☑VisualWorks WebVelocity

Memory MonitorButtons

Wednesday, March 16, 2011

Page 7: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

• 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

Memory MonitorButtons

Wednesday, March 16, 2011

Page 8: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

• 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

Memory MonitorButtons

Wednesday, March 16, 2011

Page 9: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 10: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Debugger TipsWatches

• “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

Page 11: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Debugger TipsClass 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

Page 12: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Debugger TipsRecompile 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

Page 13: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Debugger TipsCopy 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

Page 14: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Benchmarking Framework

☑ObjectStudio ☑VisualWorks WebVelocity

Wednesday, March 16, 2011

Page 15: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

☑ObjectStudio ☑VisualWorks WebVelocity

Examples used: BenchmarkingTest.store

Wednesday, March 16, 2011

Page 16: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Communications Logging Tool

☑ObjectStudio ☑VisualWorks WebVelocity

Wednesday, March 16, 2011

Page 17: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 18: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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.

☑ObjectStudio ☑VisualWorks WebVelocity

Examples used: BenchmarkingTest.store

Wednesday, March 16, 2011

Page 19: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

TranscriptDebugging 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

☑ObjectStudio ☑VisualWorks ☑WebVelocity

Examples used: TemperatureConverterApp

Wednesday, March 16, 2011

Page 20: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

TranscriptDebugging 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.

☑ObjectStudio ☑VisualWorks ☑WebVelocity

Examples used: TemperatureConverterApp

Wednesday, March 16, 2011

Page 21: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

TranscriptSaving 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

Page 22: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

TranscriptSaving 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"

ObjectStudio ☑VisualWorks ☑WebVelocity

Examples used: TemperatureConverterApp

Wednesday, March 16, 2011

Page 23: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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.*

☑ObjectStudio ☑VisualWorks WebVelocity

Examples used: Sample Browser ➜ Buttons ➜ Button Example

Wednesday, March 16, 2011

Page 24: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Spy Toollimitations

• 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.

☑ObjectStudio ☑VisualWorks WebVelocity

Examples used: Sample Browser ➜ Buttons ➜ Button Example

Wednesday, March 16, 2011

Page 25: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 26: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 27: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

VM Command Line OptionsObjectStudio

• <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

Page 28: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Image Command Line OptionsVisualWorks 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

Page 29: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Image Command Line OptionsObjectStudio

• <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

Page 30: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 31: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 32: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 33: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 34: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 35: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 36: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

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

Page 37: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Who is Poly and why does she keep changing?

Q

☑ObjectStudio ☑VisualWorks ☑WebVelocity

& A

Wednesday, March 16, 2011

Page 38: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Contact info

• Star Team (Smalltalk Strategic Resources) [email protected] Smalltalk Program Director [email protected] Smalltalk Product Manager [email protected] Smalltalk Marketing Manager

• http://www.cincomsmalltalk.com

Wednesday, March 16, 2011

Page 39: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

Wednesday, March 16, 2011

Page 40: Assaying the Hidden Debugging Gems in Cincom Smalltalk - James Savidge

© 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