Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The road to remote debugger

The road to remote debugger

Thu, August 25, 11:00am – 11:30am

First Name: Denis
Last Name: Kudriashov
Email where you can always be reached:
Title: The road to remote debugger
Type: Talk

Abstract: Debugger is a tool to lively explore system behaviour and analyze it failures. Smalltalk debugger implements unique features which makes this
process much more effective: editing methods on fly, restarting method execution, inspecting variables, executing scripts, forking new debuggers and much
more. But debuggers in smalltalk systems are only working on local environment. Smalltalk's still lack remote development tools.
In this presentation I will show how smalltalk tools could be used transparently on remote environment. I will show problems and solutions to achieve this
goals. I will demonstrate debugging remote Pharo images.

Bio: Denis Kudriashov is currently working as engineer in RMOD-INRIA team on project "remote development tools". He has been working with Smalltalk around
10 years. In the past he had also worked in Russian bank using Pharo Smalltalk and Java. Nowadays, he is maintainer to several open-source projects like
Mocketry, Presenty, Seamless Ghost, etc.

  • Login to see the comments

  • Be the first to like this

The road to remote debugger

  1. 1. The road to the remote debugger Remote debugger behind the scenes
  2. 2. Seamless Basys ObjectTravel ObjectStatistics TostSerializer GT Extensions GTInspector GTDebugger The road to the remote debugger
  3. 3. Debugger picture to show separate views StackView SourceCodeView VariablesView
  4. 4. Process suspendedContext Stack Sender context 1 Sender context 2 … Each context receiver classselector arguments temps method methodClass temp names instVarNames source code arg names Exception signalerContext Sender context 3 Root context Each object printString
  5. 5. Demo for slow remote debugger
  6. 6. Seamless • New Remote Smalltalk implementation • Started at 2012 by Nikolaos Papoulias • Redesigned this year •!/~Pharo/Seamless
  7. 7. Asynchronous network • Simultaneous sending and receiving data • Data sending not depends on data receiving • Asynchronous processing of received data • Data processing not blocks new incoming data • Every received data is processed in separate thread
  8. 8. Basys • Bidirectional asynchronous network • Client can send data to server • Server can send data to client • Both directions are equivalent • But usually server can’t establish new connections • Asynchronous data transfer
  9. 9. Peer B Peer A Peer C Basys models network as connected peers
  10. 10. Network peer structure BasysNetwork BasysRemotePeer B BasysLocalPeer BasysRemotePeer C localPeer remotePeers
  11. 11. Peers interact by connection pool Peer B RemotePeer A Peer A RemotePeer B Connection 1 Connection 2 Connection 3 Connection 1 Connection 2 Connection 3 Connection pool Connection pool
  12. 12. • Users not work directly with connections • Users ask peer to send data to remote side peer := network remotePeerAt: tcpAddress. peer sendDataPacket: dataObject • Connections are established by demand • Established connections are reused Peers interact by connection pool
  13. 13. Seamless implements Basys network • What is data? • aSeamlessRequest (MessageSendRequest, DeliveryResultRequest) • What to do with data? • aSeamlessRequest executeFor: senderPeer
  14. 14. Seamless implements Basys network • What is data? • aSeamlessRequest (MessageSendRequest, DeliveryResultRequest) • What to do with data? • aSeamlessRequest executeFor: senderPeer • How to send data? • objects are serialized on connection stream by serialization library. • transfer strategies are applied to each node of given object graph to decide how to transfer them: • by value • by reference • others • strategies are object specific and could be redefined for application • How to receive data? • objects are materialized from connection stream by serialization library. • on receiver side they could be represented by specific objects (proxies, local globals)
  15. 15. Seamless • First class strategies to transfer objects • by value • by reference • by reference with cached properties • properties can be transferred by reference too • by referenced copy • by deep copy • by global name (to transfer well known globals) • other specific strategies
  16. 16. Remote debugger tuning network transferByReference: (Kind of: CompiledMethod) withCacheFor: #(selector methodClass isTestMethod argumentNames). network transferByReference: (Kind of: Context) withCacheFor: #(receiver method methodClass methodSelector isBlockContext home tempNames isDead selector sender debuggerMap outerContext outerMostContext closure). network transferByValue: (Kind of: Slot). network transferByReference: (Kind of: ClassDescription) withCacheFor: #(name allInstVarNames allSlots). network transferByValue: (Kind of: OrderedCollection). network transferByValue: (Kind of: Set). network transferByValue: (Kind of: Interval). network transferByValue: (Kind of: Array).
  17. 17. Real debugger demo • On server side: • RemoteUIManager registerOnPort: 40423 • On client side: • RemoteDebugger connectTo: anAddress
  18. 18. GT extensions • GTInspetor on proxies: • Raw tab for remote state • Proxy tab for internal proxy state • DoIt by SeamlessRemoteClassCompiler • all variables and globals are bound to proxies • self is bound to proxy • #doIt method is compiled locally but executed on remote side • remote side could not have compiler
  19. 19. TostSerializer • Transient objects transport • not for persistence • serialize on sender and materialize on receiver • No meta information for objects • no versioning • no migration support • Objects are stream of references • which directly written on output stream in same order • which directly read from input stream in same order • Support objects with cyclic references • duplicated objects are encoded by stream position of original object • Support for object substitutions • substitutions are just injected into object stream • Compact encoding for well known objects and classes • one byte for encoding
  20. 20. TostSerializer in Seamless • One pass object traversal • With Fuel it was two: • Fuel itself analyses object graph • Seamless traverse object graph to build substitution map • Very compact for small objects • Smallest communication unit (integer return): • 21 bytes for Tost versus 400 bytes for Fuel • Many possibilities for new features and optimizations: • references should not send cache back to server • objects state synchronization between client and server • cache should be updated when reference is received again from server
  21. 21. ObjectTravel • Main part of TostSerializer
  22. 22. ObjectTravel • Tool to stream objects • traversal stream of inst vars and indexed fields traveler := ObjectTravel on: (1@2 corner: 3@4). traveler nextReference. “ => 1@2” traveler nextReferece; nextReference. “=> 1” “or” traveler referencesDo: [:each | ]. • Support cyclic object graphs • Allow inject external objects traveler referencesDo: [:each | each = 2 ifTrue: [traveler atNextStepVisit: 5@6]]. • Allow replace references traveler referencesDo: [:each | each = 2 ifTrue: [traveler replaceCurrentReferenceWith: 5]].
  23. 23. ObjectTravel • Useful methods: traveler := ObjectTravel on: (1@2 corner: 3@4). • traveler countReferences “=> 6” • traveler collectReferences “=> {1@2. 3@4. 1. 2. 3. 4}” • traveler copyObject “=> deep copy of rectangle” • traveler findAllPathTo: 2 “=> { {1@2} }”
  24. 24. ObjectStatistics • Tool to analyze set of objects • computes different kind of metrics from different perspective (dimensions) • simplistic OLAP Cube in objects space. • Implements suitable GT extension • Metrics and dimensions shown in tree way inside GTInspector
  25. 25. SeamlessStatistics stat := ObjectStatistics new. stat countAllAs: 'requests'; countDifferent: [ :r | r receiver ] as: 'instances' for: (Kind of: SeamlessMessageSendRequest); countAllSuch: #isOutgoing as: 'outgoing'; countAllSuch: #isIncoming as: 'incoming'. stat dimension: [ :r | r class ] named: 'requests'; for: (Kind of: SeamlessMessageSendRequest) with: [ stat dimension: [ :r | r receiver nameForSeamlessStatistics ] named: 'classes'; with: [ stat dimension: [ :r | r selector ] named: 'msgs']. stat dimension: [ :r | r selector ] named: 'msgs'; with: [ stat dimension: [ :r | r receiver nameForSeamlessStatistics ] named: 'classes']]. stat accumulateAll: requests.
  26. 26. Future work • Remote browser • More optimizations • Better presentation of remote contexts • Support for stepInto for remote call • distributed stack in debugger • Distributed garbage collection • now it is absent • “debugger disconnect” cleans everything
  27. 27. The end • follow me on • questions?