summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorFrederic Leger2012-09-24 10:45:02 (EDT)
committer Anton Leherbauer2012-09-24 10:45:02 (EDT)
commit9b59f7ed4b5292f49c9e244d17365acf601d3c4f (patch)
treeb40ea338961254516fa79418622d9f4f6629580e
parent40e77cd79e5344d6cab49acdc7808de9434668ed (diff)
downloadorg.eclipse.tcf-9b59f7ed4b5292f49c9e244d17365acf601d3c4f.zip
org.eclipse.tcf-9b59f7ed4b5292f49c9e244d17365acf601d3c4f.tar.gz
org.eclipse.tcf-9b59f7ed4b5292f49c9e244d17365acf601d3c4f.tar.bz2
TCF Python: Bug 390178 - Missing APIs/properties in python services
interfaces and proxies
-rw-r--r--python/src/tcf/services/__init__.py56
-rw-r--r--python/src/tcf/services/breakpoints.py51
-rw-r--r--python/src/tcf/services/diagnostics.py75
-rw-r--r--python/src/tcf/services/disassembly.py38
-rw-r--r--python/src/tcf/services/expressions.py120
-rw-r--r--python/src/tcf/services/filesystem.py186
-rw-r--r--python/src/tcf/services/linenumbers.py76
-rw-r--r--python/src/tcf/services/locator.py64
-rw-r--r--python/src/tcf/services/memory.py160
-rw-r--r--python/src/tcf/services/memorymap.py50
-rw-r--r--python/src/tcf/services/pathmap.py50
-rw-r--r--python/src/tcf/services/processes.py82
-rw-r--r--python/src/tcf/services/registers.py235
-rw-r--r--python/src/tcf/services/remote/DisassemblyProxy.py32
-rw-r--r--python/src/tcf/services/remote/SymbolsProxy.py153
-rw-r--r--python/src/tcf/services/runcontrol.py3
-rw-r--r--python/src/tcf/services/stacktrace.py61
-rw-r--r--python/src/tcf/services/streams.py100
-rw-r--r--python/src/tcf/services/symbols.py188
-rw-r--r--python/src/tcf/services/sysmonitor.py49
20 files changed, 1307 insertions, 522 deletions
diff --git a/python/src/tcf/services/__init__.py b/python/src/tcf/services/__init__.py
index 1432a02..ef65adc 100644
--- a/python/src/tcf/services/__init__.py
+++ b/python/src/tcf/services/__init__.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,32 +7,39 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
-import threading, collections
+import collections
+import threading
from tcf import protocol
_providers = []
_lock = threading.RLock()
+
class ServiceProvider(object):
"""
- Clients can implement this abstract class if they want to provide implementation of a local service or
- remote service proxy.
+ Clients can implement this abstract class if they want to provide
+ implementation of a local service or remote service proxy.
"""
+
def getLocalService(self, channel):
pass
+
def getServiceProxy(self, channel, service_name):
pass
+
def addServiceProvider(provider):
with _lock:
_providers.append(provider)
+
def removeServiceProvider(provider):
with _lock:
_providers.remove(provider)
+
def onChannelCreated(channel, services_by_name):
with _lock:
# TODO ZeroCopy support is incomplete
@@ -41,12 +48,15 @@ def onChannelCreated(channel, services_by_name):
for provider in _providers:
try:
arr = provider.getLocalService(channel)
- if not arr: continue
+ if not arr:
+ continue
for service in arr:
- if service.getName() in services_by_name: continue
+ if service.getName() in services_by_name:
+ continue
services_by_name[service.getName()] = service
except Exception as x:
- protocol.log("Error calling TCF service provider", x);
+ protocol.log("Error calling TCF service provider", x)
+
def onChannelOpened(channel, service_names, services_by_name):
with _lock:
@@ -54,40 +64,52 @@ def onChannelOpened(channel, service_names, services_by_name):
for provider in _providers:
try:
service = provider.getServiceProxy(channel, name)
- if not service: continue
+ if not service:
+ continue
services_by_name[name] = service
break
except Exception as x:
protocol.log("Error calling TCF service provider", x)
- if name in services_by_name: continue
+ if name in services_by_name:
+ continue
services_by_name[name] = GenericProxy(channel, name)
+
def getServiceManagerID():
# In current implementation ServiceManager is a singleton,
# so its ID is same as agent ID.
return protocol.getAgentID()
+
class GenericCallback(object):
+
def __init__(self, callback):
self.callback = callback
+
def __getattr__(self, attr):
if attr.startswith("done"):
return self.callback
+
class Service(object):
+
def getName(self):
raise NotImplementedError("Abstract method")
+
def __str__(self):
return self.getName()
+
def _makeCallback(self, done):
if isinstance(done, collections.Callable):
return GenericCallback(done)
return done
+
class ZeroCopy(Service):
def getName(self):
return "ZeroCopy"
+
class GenericProxy(Service):
"""
* Objects of GenericProxy class represent remote services, which don't
@@ -95,33 +117,41 @@ class GenericProxy(Service):
* Clients still can use such services, but framework will not provide
* service specific utility methods for message formatting and parsing.
"""
+
def __init__(self, channel, name):
self.__channel = channel
self.name = name
+
def getName(self):
return self.name
+
def getChannel(self):
return self.__channel
+
class DefaultServiceProvider(ServiceProvider):
package_base = "tcf.services.remote"
+
def getLocalService(self, channel):
# TODO DiagnosticsService
#return [DiagnosticsService(channel)]
return []
+
def getServiceProxy(self, channel, service_name):
service = None
try:
clsName = service_name + "Proxy"
package = self.package_base + "." + clsName
- clsModule = __import__(package, fromlist=[clsName], globals=globals())
+ clsModule = __import__(package, fromlist=[clsName],
+ globals=globals())
cls = clsModule.__dict__.get(clsName)
service = cls(channel)
assert service_name == service.getName()
except ImportError:
pass
except Exception as x:
- protocol.log("Cannot instantiate service proxy for "+service_name, x)
+ protocol.log("Cannot instantiate service proxy for " +
+ service_name, x)
return service
addServiceProvider(DefaultServiceProvider())
diff --git a/python/src/tcf/services/breakpoints.py b/python/src/tcf/services/breakpoints.py
index 35a8f16..b0b2113 100644
--- a/python/src/tcf/services/breakpoints.py
+++ b/python/src/tcf/services/breakpoints.py
@@ -35,24 +35,36 @@ NAME = "Breakpoints"
PROP_ID = "ID" # String
PROP_ENABLED = "Enabled" # Boolean
PROP_TYPE = "BreakpointType" # String
-PROP_CONTEXTNAMES = "ContextNames" # Array
-PROP_CONTEXTIDS = "ContextIds" # Array
-PROP_EXECUTABLEPATHS = "ExecPaths" # Array
+PROP_CONTEXT_NAMES = "ContextNames" # Array
+PROP_CONTEXT_IDS = "ContextIds" # Array
+PROP_EXECUTABLE_PATHS = "ExecPaths" # Array
+PROP_CONTEXT_QUERY = "ContextQuery" # String, see IContextQuery
PROP_LOCATION = "Location" # String
PROP_SIZE = "Size" # Number
-PROP_ACCESSMODE = "AccessMode" # Number
+PROP_ACCESS_MODE = "AccessMode" # Number
PROP_FILE = "File" # String
PROP_LINE = "Line" # Number
PROP_COLUMN = "Column" # Number
PROP_PATTERN = "MaskValue" # Number
PROP_MASK = "Mask" # Number
PROP_STOP_GROUP = "StopGroup" # Array
-PROP_IGNORECOUNT = "IgnoreCount" # Number
+PROP_IGNORE_COUNT = "IgnoreCount" # Number
PROP_TIME = "Time" # Number
PROP_SCALE = "TimeScale" # String
PROP_UNITS = "TimeUnits" # String
PROP_CONDITION = "Condition" # String
PROP_TEMPORARY = "Temporary" # Boolean
+PROP_EVENT_TYPE = "EventType" # String
+PROP_EVENT_ARGS = "EventArgs" # String or Object
+PROP_CLIENT_DATA = "ClientData" # Object
+
+# Deprecated
+PROP_CONTEXTNAMES = "ContextNames" # Array
+PROP_CONTEXTIDS = "ContextIds" # Array
+PROP_EXECUTABLEPATHS = "ExecPaths" # Array
+PROP_ACCESSMODE = "AccessMode" # Number
+PROP_IGNORECOUNT = "IgnoreCount" # Number
+
# BreakpointType values
TYPE_SOFTWARE = "Software"
@@ -82,20 +94,37 @@ STATUS_LINE = "Line" # Number
STATUS_COLUMN = "Column" # Number
# Breakpoint instance field names.
-INSTANCE_ERROR = "Error" # String
-INSTANCE_CONTEXT = "LocationContext" # String
-INSTANCE_ADDRESS = "Address" # Number
+INSTANCE_ERROR = "Error" # String
+INSTANCE_CONTEXT = "LocationContext" # String
+INSTANCE_ADDRESS = "Address" # Number
+INSTANCE_SIZE = "Size" # Number
+INSTANCE_TYPE = "BreakpointType" # String
+INSTANCE_MEMORY_CONTEXT = "MemoryContext" # String
+INSTANCE_HIT_COUNT = "HitCount" # Number
# Breakpoint service capabilities.
CAPABILITY_CONTEXT_ID = "ID" # String
CAPABILITY_HAS_CHILDREN = "HasChildren" # Boolean
+CAPABILITY_BREAKPOINT_TYPE = "BreakpointType" # Boolean
CAPABILITY_LOCATION = "Location" # Boolean
CAPABILITY_CONDITION = "Condition" # Boolean
CAPABILITY_FILE_LINE = "FileLine" # Boolean
-CAPABILITY_CONTEXTIDS = "ContextIds" # Boolean
+CAPABILITY_FILE_MAPPING = "FileMapping" # Boolean
+CAPABILITY_CONTEXT_IDS = "ContextIds" # Boolean
+CAPABILITY_CONTEXT_NAMES = "ContextNames" # Boolean
+CAPABILITY_CONTEXT_QUERY = "ContextQuery" # Boolean
CAPABILITY_STOP_GROUP = "StopGroup" # Boolean
-CAPABILITY_IGNORECOUNT = "IgnoreCount" # Boolean
-CAPABILITY_ACCESSMODE = "AccessMode" # Number
+CAPABILITY_TEMPORARY = "Temporary" # Boolean
+CAPABILITY_IGNORE_COUNT = "IgnoreCount" # Boolean
+CAPABILITY_ACCESS_MODE = "AccessMode" # Number
+CAPABILITY_CLIENT_DATA = "ClientData" # Boolean
+
+# Deprecated
+
+CAPABILITY_CONTEXTNAMES = "ContextNames"
+CAPABILITY_CONTEXTIDS = "ContextIds"
+CAPABILITY_IGNORECOUNT = "IgnoreCount"
+CAPABILITY_ACCESSMODE = "AccessMode"
class BreakpointsService(services.Service):
diff --git a/python/src/tcf/services/diagnostics.py b/python/src/tcf/services/diagnostics.py
index d16ae51..ea4e40a 100644
--- a/python/src/tcf/services/diagnostics.py
+++ b/python/src/tcf/services/diagnostics.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
This is an optional service that can be implemented by a peer.
@@ -19,15 +19,17 @@ from tcf import services
NAME = "Diagnostics"
+
class DiagnosticsService(services.Service):
def getName(self):
return NAME
def echo(self, s, done):
"""
- 'echo' command result returns same string that was given as command argument.
- The command is used to test communication channel ability to transmit arbitrary strings in
- both directions.
+ 'echo' command result returns same string that was given as command
+ argument.
+ The command is used to test communication channel ability to transmit
+ arbitrary strings in both directions.
@param s - any string.
@param done - command result call back object.
@return - pending command handle.
@@ -36,9 +38,10 @@ class DiagnosticsService(services.Service):
def echoFP(self, n, done):
"""
- 'echoFP' command result returns same floating point number that was given as command argument.
- The command is used to test communication channel ability to transmit arbitrary floating point numbers in
- both directions.
+ 'echoFP' command result returns same floating point number that was
+ given as command argument.
+ The command is used to test communication channel ability to transmit
+ arbitrary floating point numbers in both directions.
@param n - any floating point number.
@param done - command result call back object.
@return - pending command handle.
@@ -47,8 +50,10 @@ class DiagnosticsService(services.Service):
def echoERR(self, error, done):
"""
- 'echoERR' command result returns same error report that was given as command argument.
- The command is used to test remote agent ability to receive and transmit TCF error reports.
+ 'echoERR' command result returns same error report that was given as
+ command argument.
+ The command is used to test remote agent ability to receive and
+ transmit TCF error reports.
@param error - an error object.
@param done - command result call back object.
@return - pending command handle.
@@ -61,9 +66,10 @@ class DiagnosticsService(services.Service):
Clients can request remote peer to run a test from the list.
When started, a test performs a predefined set actions.
Nature of test actions is uniquely identified by test name.
- Exact description of test actions is a contract between client and remote peer,
- and it is not part of Diagnostics service specifications.
- Clients should not attempt to run a test if they don't recognize the test name.
+ Exact description of test actions is a contract between client and
+ remote peer, and it is not part of Diagnostics service specifications.
+ Clients should not attempt to run a test if they don't recognize the
+ test name.
@param done - command result call back object.
@return - pending command handle.
"""
@@ -74,8 +80,9 @@ class DiagnosticsService(services.Service):
Run a test. When started, a test performs a predefined set actions.
Nature of test actions is uniquely identified by test name.
Running test usually has associated execution context ID.
- Depending on the test, the ID can be used with services RunControl and/or Processes services to control
- test execution, and to obtain test results.
+ Depending on the test, the ID can be used with services RunControl
+ and/or Processes services to control test execution, and to obtain
+ test results.
@param name - test name
@param done - command result call back object.
@return - pending command handle.
@@ -104,8 +111,8 @@ class DiagnosticsService(services.Service):
def createTestStreams(self, inp_buf_size, out_buf_size, done):
"""
Create a pair of virtual streams, @see IStreams service.
- Remote ends of the streams are connected, so any data sent into 'inp' stream
- will become for available for reading from 'out' stream.
+ Remote ends of the streams are connected, so any data sent into 'inp'
+ stream will become for available for reading from 'out' stream.
The command is used for testing virtual streams.
@param inp_buf_size - buffer size in bytes of the input stream.
@param out_buf_size - buffer size in bytes of the output stream.
@@ -114,10 +121,11 @@ class DiagnosticsService(services.Service):
"""
return NotImplementedError("Abstract method")
- def disposeTestStream(self, id, done):
+ def disposeTestStream(self, streamID, done):
"""
- Dispose a virtual stream that was created by 'createTestStreams' command.
- @param id - the stream ID.
+ Dispose a virtual stream that was created by 'createTestStreams'
+ command.
+ @param streamID - the stream ID.
@param done - command result call back object.
@return - pending command handle.
"""
@@ -146,6 +154,7 @@ class DoneEcho(object):
"""
pass
+
class DoneEchoFP(object):
"""
Call back interface for 'echoFP' command.
@@ -159,6 +168,7 @@ class DoneEchoFP(object):
"""
pass
+
class DoneEchoERR(object):
"""
Call back interface for 'echoERR' command.
@@ -168,24 +178,27 @@ class DoneEchoERR(object):
Called when 'echoERR' command is done.
@param token - command handle.
@param error - communication error report or None.
- @param error_obj - error object, should be equal to the command argument.
+ @param error_obj - error object, should be equal to the command
+ argument.
@param error_msg - error object converted to a human readable string.
"""
pass
+
class DoneGetTestList(object):
"""
Call back interface for 'getTestList' command.
"""
- def doneGetTestList(self, token, error, list):
+ def doneGetTestList(self, token, error, testList):
"""
Called when 'getTestList' command is done.
@param token - command handle.
@param error - error object or None.
- @param list - names of tests that are supported by the peer.
+ @param testList - names of tests that are supported by the peer.
"""
pass
+
class DoneRunTest(object):
"""
Call back interface for 'runTest' command.
@@ -199,6 +212,7 @@ class DoneRunTest(object):
"""
pass
+
class DoneCancelTest(object):
"""
Call back interface for 'cancelTest' command.
@@ -211,6 +225,7 @@ class DoneCancelTest(object):
"""
pass
+
class DoneGetSymbol(object):
"""
Call back interface for 'getSymbol' command.
@@ -224,31 +239,41 @@ class DoneGetSymbol(object):
"""
pass
+
class Symbol(object):
"""
Represents result value of 'getSymbol' command.
"""
+
def __init__(self, props):
self._props = props or {}
+
def getSectionName(self):
return self._props.get("Section")
+
def getValue(self):
return self._props.get("Value")
+
def isUndef(self):
val = self._props.get("Storage")
return val == "UNDEF"
+
def isCommon(self):
val = self._props.get("Storage")
return val == "COMMON"
+
def isGlobal(self):
val = self._props.get("Storage")
return val == "GLOBAL"
+
def isLocal(self):
val = self._props.get("Storage")
return val == "LOCAL"
+
def isAbs(self):
return self._props.get("Abs", False)
+
class DoneCreateTestStreams(object):
"""
Call back interface for 'createTestStreams' command.
@@ -263,6 +288,7 @@ class DoneCreateTestStreams(object):
"""
pass
+
class DoneDisposeTestStream(object):
"""
Call back interface for 'disposeTestStream' command.
@@ -275,6 +301,7 @@ class DoneDisposeTestStream(object):
"""
pass
+
class DoneNotImplementedCommand(object):
def doneNotImplementedCommand(self, token, error):
"""
diff --git a/python/src/tcf/services/disassembly.py b/python/src/tcf/services/disassembly.py
index f5260c3..6b03340 100644
--- a/python/src/tcf/services/disassembly.py
+++ b/python/src/tcf/services/disassembly.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
TCF Disassembly service interface.
@@ -34,7 +34,8 @@ FIELD_TYPE = "Type"
# Value of the field for "String" and "Register" types, String.
FIELD_TEXT = "Text"
-# Value of the field for "Address," "Displacement," or "Immediate" types, Number.
+# Value of the field for "Address," "Displacement," or "Immediate" types,
+# Number.
FIELD_VALUE = "Value"
# Context ID of the address space used with "Address" types, String.
@@ -55,7 +56,8 @@ class DisassemblyService(services.Service):
def getCapabilities(self, context_id, done):
"""
Retrieve disassembly service capabilities a given context-id.
- @param context_id - a context ID, usually one returned by Run Control or Memory services.
+ @param context_id - a context ID, usually one returned by Run Control
+ or Memory services.
@param done - command result call back object.
@return - pending command handle.
"""
@@ -63,11 +65,14 @@ class DisassemblyService(services.Service):
def disassemble(self, context_id, addr, size, params, done):
"""
- Disassemble instruction code from a specified range of memory addresses, in a specified context.
- @param context_id - a context ID, usually one returned by Run Control or Memory services.
+ Disassemble instruction code from a specified range of memory
+ addresses, in a specified context.
+ @param context_id - a context ID, usually one returned by Run Control
+ or Memory services.
@param addr - address of first instruction to disassemble.
@param size - size in bytes of the address range.
- @param params - properties to control the disassembly output, an element of capabilities array, see getCapabilities.
+ @param params - properties to control the disassembly output, an
+ element of capabilities array, see getCapabilities.
@param done - command result call back object.
@return - pending command handle.
"""
@@ -82,10 +87,12 @@ class DoneGetCapabilities(object):
Called when capabilities retrieval is done.
@param token - command handle.
@param error - error object or None.
- @param capabilities - array of capabilities, see CAPABILITY_* for contents of each array element.
+ @param capabilities - array of capabilities, see CAPABILITY_* for
+ contents of each array element.
"""
pass
+
class DoneDisassemble(object):
"""
Call back interface for 'disassemble' command.
@@ -99,14 +106,16 @@ class DoneDisassemble(object):
"""
pass
+
class DisassemblyLine(object):
"""
Represents a single disassembly line.
"""
- def __init__(self, addr, size, instruction):
+ def __init__(self, addr, size, instruction, opcode=None):
self.addr = addr
self.size = size or 0
self.instruction = instruction
+ self.opcode = opcode
def getAddress(self):
"""
@@ -114,6 +123,12 @@ class DisassemblyLine(object):
"""
return self.addr
+ def getOpcodeValue(self):
+ """
+ @return instruction address.
+ """
+ return self.opcode
+
def getSize(self):
"""
@return instruction size in bytes.
@@ -122,7 +137,8 @@ class DisassemblyLine(object):
def getInstruction(self):
"""
- @return array of instruction fields, each field is a collection of field properties, see FIELD_*.
+ @return array of instruction fields, each field is a collection of
+ field properties, see FIELD_*.
"""
return self.instruction
diff --git a/python/src/tcf/services/expressions.py b/python/src/tcf/services/expressions.py
index 8ff7b32..fdf3a72 100644
--- a/python/src/tcf/services/expressions.py
+++ b/python/src/tcf/services/expressions.py
@@ -1,4 +1,4 @@
-# *******************************************************************************
+# *****************************************************************************
# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
@@ -7,11 +7,13 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
-Expressions service allows TCF client to perform expression evaluation on remote target.
-The service can be used to retrieve or modify values of variables or any data structures in remote target memory.
+Expressions service allows TCF client to perform expression evaluation on
+remote target.
+The service can be used to retrieve or modify values of variables or any data
+structures in remote target memory.
"""
from tcf import services
@@ -19,12 +21,16 @@ from tcf import services
# Service name.
NAME = "Expressions"
+
class Expression(object):
"""
- Expression object represent an expression that can be evaluated by remote target.
- It has a unique ID and contains all information necessary to compute a value.
+ Expression object represent an expression that can be evaluated by remote
+ target.
+ It has a unique ID and contains all information necessary to compute a
+ value.
The object data usually includes:
- 1. process, thread or stack frame ID that should be used to resolve symbol names
+ 1. process, thread or stack frame ID that should be used to resolve
+ symbol names
2. a script that can compute a value, like "x.y + z"
"""
def __init__(self, props):
@@ -63,7 +69,8 @@ class Expression(object):
def getSymbolID(self):
"""
- Return symbol ID if the expression represents a symbol (e.g. local variable).
+ Return symbol ID if the expression represents a symbol (e.g. local
+ variable).
@return symbol ID
"""
return self._props.get(PROP_SYMBOL_ID)
@@ -71,7 +78,8 @@ class Expression(object):
def getBits(self):
"""
Get size of expression value in bits.
- Can be 0 if value size is even number of bytes, use getSize() in such case.
+ Can be 0 if value size is even number of bytes, use getSize() in such
+ case.
@return size in bits.
"""
return self._props.get(PROP_BITS, 0)
@@ -86,9 +94,10 @@ class Expression(object):
def getTypeID(self):
"""
- Get expression type ID. Symbols service can be used to get type properties.
- This is "static" or "declared" type ID, actual type of a value can be different -
- if expression language supports dynamic typing.
+ Get expression type ID. Symbols service can be used to get type
+ properties.
+ This is "static" or "declared" type ID, actual type of a value can be
+ different - if expression language supports dynamic typing.
@return type ID.
"""
return self._props.get(PROP_TYPE)
@@ -100,6 +109,14 @@ class Expression(object):
"""
return self._props.get(PROP_CAN_ASSIGN)
+ def hasFuncCall(self):
+ """
+ Check if the expression contains target function call.
+ Such expression can resume the target when evaluated.
+ @return true if has a function call.
+ """
+ return (self._props.get(PROP_HAS_FUNC_CALL))
+
def getProperties(self):
"""
Get complete map of context properties.
@@ -117,12 +134,16 @@ PROP_BITS = "Bits"
PROP_SIZE = "Size"
PROP_TYPE = "Type"
PROP_CAN_ASSIGN = "CanAssign"
+PROP_HAS_FUNC_CALL = "HasFuncCall"
+
class Value(object):
"""
Value represents result of expression evaluation.
- Note that same expression can be evaluated multiple times with different results.
+ Note that same expression can be evaluated multiple times with different
+ results.
"""
+
def __init__(self, value, props):
self._value = value
self._props = props or {}
@@ -148,7 +169,8 @@ class Value(object):
def isBigEndian(self):
"""
Check endianness of the values.
- Big-endian means decreasing numeric significance with increasing byte number.
+ Big-endian means decreasing numeric significance with increasing
+ byte number.
@return true if big-endian.
"""
return self._props.get(VAL_BIG_ENDIAN)
@@ -160,6 +182,20 @@ class Value(object):
"""
return self._props.get(VAL_ADDRESS)
+ def getRegisterID(self):
+ """
+ Return register ID if the value represents register variable.
+ @return register ID or None.
+ """
+ return self._props.get(VAL_REGISTER)
+
+ def getSymbolID(self):
+ """
+ Return symbol ID if the value represents a symbol.
+ @return symbol ID or None.
+ """
+ return self._props.get(VAL_SYMBOL)
+
def getValue(self):
"""
Get value as array of bytes.
@@ -182,16 +218,18 @@ VAL_REGISTER = "Register"
VAL_ADDRESS = "Address"
VAL_BIG_ENDIAN = "BigEndian"
+
class ExpressionsService(services.Service):
+
def getName(self):
return NAME
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
"""
Retrieve expression context info for given context ID.
@see Expression
- @param id - context ID.
+ @param contextID - context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
@@ -208,8 +246,8 @@ class ExpressionsService(services.Service):
5. thread - top stack frame function arguments and local variables
6. process - global variables
- Children list *does not* include IDs of expressions that were created by clients
- using "create" command.
+ Children list *does not* include IDs of expressions that were created
+ by clients using "create" command.
@param parent_context_id - parent context ID.
@param done - call back interface called when operation is completed.
@@ -221,36 +259,38 @@ class ExpressionsService(services.Service):
"""
Create an expression context.
The context should be disposed after use.
- @param parent_id - a context ID that can be used to resolve symbol names.
- @param language - language of expression script, None means default language
+ @param parent_id - a context ID that can be used to resolve symbol
+ names.
+ @param language - language of expression script, None means default
+ language
@param expression - expression script
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
raise NotImplementedError("Abstract method")
- def dispose(self, id, done):
+ def dispose(self, contextID, done):
"""
Dispose an expression context that was created by create()
- @param id - the expression context ID
+ @param contextID - the expression context ID
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
raise NotImplementedError("Abstract method")
- def evaluate(self, id, done):
+ def evaluate(self, contextID, done):
"""
Evaluate value of an expression context.
- @param id - the expression context ID
+ @param contextID - the expression context ID
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
raise NotImplementedError("Abstract method")
- def assign(self, id, value, done):
+ def assign(self, contextID, value, done):
"""
Assign a value to memory location determined by an expression.
- @param id - expression ID.
+ @param contextID - expression ID.
@param value - value as an array of bytes.
@param done - call back interface called when operation is completed.
@return - pending command handle.
@@ -271,6 +311,7 @@ class ExpressionsService(services.Service):
"""
raise NotImplementedError("Abstract method")
+
class DoneGetContext(object):
"""
Client call back interface for getContext().
@@ -279,11 +320,13 @@ class DoneGetContext(object):
"""
Called when context data retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context properties.
"""
pass
+
class DoneGetChildren(object):
"""
Client call back interface for getChildren().
@@ -292,7 +335,8 @@ class DoneGetChildren(object):
"""
Called when context list retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
"""
pass
@@ -306,11 +350,13 @@ class DoneCreate(object):
"""
Called when context create context command is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context properties.
"""
pass
+
class DoneDispose(object):
"""
Client call back interface for dispose().
@@ -319,10 +365,12 @@ class DoneDispose(object):
"""
Called when context dispose command is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
"""
pass
+
class DoneEvaluate(object):
"""
Client call back interface for evaluate().
@@ -331,11 +379,13 @@ class DoneEvaluate(object):
"""
Called when context dispose command is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param value - expression evaluation result
"""
pass
+
class DoneAssign(object):
"""
Client call back interface for assign().
@@ -344,16 +394,18 @@ class DoneAssign(object):
"""
Called when assign command is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
"""
pass
+
class ExpressionsListener(object):
"""
Registers event listener is notified when registers context hierarchy
changes, and when a register is modified by the service commands.
"""
- def valueChanged(self, id):
+ def valueChanged(self, contextID):
"""
Called when expression value was changed and clients
need to update themselves. Clients, at least, should invalidate
@@ -361,6 +413,6 @@ class ExpressionsListener(object):
Not every change is notified - it is not possible,
only those, which are not caused by normal execution of the debuggee.
At least, changes caused by "assign" command should be notified.
- @param id - expression context ID.
+ @param contextID - expression context ID.
"""
pass
diff --git a/python/src/tcf/services/filesystem.py b/python/src/tcf/services/filesystem.py
index d0148dd..bfead0d 100644
--- a/python/src/tcf/services/filesystem.py
+++ b/python/src/tcf/services/filesystem.py
@@ -77,37 +77,38 @@ NAME = "FileSystem"
# Flags to be used with open() method.
# Open the file for reading.
-TCF_O_READ = 0x00000001
+TCF_O_READ = 0x00000001
# Open the file for writing. If both this and TCF_O_READ are
# specified, the file is opened for both reading and writing.
-TCF_O_WRITE = 0x00000002
+TCF_O_WRITE = 0x00000002
# Force all writes to append data at the end of the file.
-TCF_O_APPEND = 0x00000004
+TCF_O_APPEND = 0x00000004
# If this flag is specified, then a new file will be created if one
# does not already exist (if TCF_O_TRUNC is specified, the new file will
# be truncated to zero length if it previously exists).
-TCF_O_CREAT = 0x00000008
+TCF_O_CREAT = 0x00000008
# Forces an existing file with the same name to be truncated to zero
# length when creating a file by specifying TCF_O_CREAT.
# TCF_O_CREAT MUST also be specified if this flag is used.
-TCF_O_TRUNC = 0x00000010
+TCF_O_TRUNC = 0x00000010
# Causes the request to fail if the named file already exists.
# TCF_O_CREAT MUST also be specified if this flag is used.
-TCF_O_EXCL = 0x00000020
+TCF_O_EXCL = 0x00000020
# Flags to be used together with FileAttrs.
# The flags specify which of the fields are present. Those fields
# for which the corresponding flag is not set are not present (not
# included in the message).
-ATTR_SIZE = 0x00000001
-ATTR_UIDGID = 0x00000002
-ATTR_PERMISSIONS = 0x00000004
-ATTR_ACMODTIME = 0x00000008
+ATTR_SIZE = 0x00000001
+ATTR_UIDGID = 0x00000002
+ATTR_PERMISSIONS = 0x00000004
+ATTR_ACMODTIME = 0x00000008
+
class FileAttrs(object):
"""
@@ -132,7 +133,8 @@ class FileAttrs(object):
midnight Jan 1, 1970 in UTC.
attributes - Additional (non-standard) attributes.
"""
- def __init__(self, flags, size, uid, gid, permissions, atime, mtime, attributes):
+ def __init__(self, flags, size, uid, gid, permissions, atime, mtime,
+ attributes):
self.flags = flags
self.size = size
self.uid = uid
@@ -144,48 +146,55 @@ class FileAttrs(object):
def isFile(self):
"""
- Determines if the file system object is a file on the remote file system.
+ Determines if the file system object is a file on the remote file
+ system.
- @return True if and only if the object on the remote system can be considered to have "contents" that
- have the potential to be read and written as a byte stream.
+ @return True if and only if the object on the remote system can be
+ considered to have "contents" that have the potential to be
+ read and written as a byte stream.
"""
- if (self.flags & ATTR_PERMISSIONS) == 0: return False
+ if (self.flags & ATTR_PERMISSIONS) == 0:
+ return False
return (self.permissions & S_IFMT) == S_IFREG
def isDirectory(self):
"""
- Determines if the file system object is a directory on the remote file system.
+ Determines if the file system object is a directory on the remote file
+ system.
- @return True if and only if the object on the remote system is a directory.
- That is, it contains entries that can be interpreted as other files.
+ @return True if and only if the object on the remote system is a
+ directory. That is, it contains entries that can be interpreted
+ as other files.
"""
- if (self.flags & ATTR_PERMISSIONS) == 0: return False
+ if (self.flags & ATTR_PERMISSIONS) == 0:
+ return False
return (self.permissions & S_IFMT) == S_IFDIR
# The following flags are defined for the 'permissions' field:
-S_IFMT = 0170000 # bitmask for the file type bitfields
-S_IFSOCK = 0140000 # socket
-S_IFLNK = 0120000 # symbolic link
-S_IFREG = 0100000 # regular file
-S_IFBLK = 0060000 # block device
-S_IFDIR = 0040000 # directory
-S_IFCHR = 0020000 # character device
-S_IFIFO = 0010000 # fifo
-S_ISUID = 0004000 # set UID bit
-S_ISGID = 0002000 # set GID bit (see below)
-S_ISVTX = 0001000 # sticky bit (see below)
-S_IRWXU = 00700 # mask for file owner permissions
-S_IRUSR = 00400 # owner has read permission
-S_IWUSR = 00200 # owner has write permission
-S_IXUSR = 00100 # owner has execute permission
-S_IRWXG = 00070 # mask for group permissions
-S_IRGRP = 00040 # group has read permission
-S_IWGRP = 00020 # group has write permission
-S_IXGRP = 00010 # group has execute permission
-S_IRWXO = 00007 # mask for permissions for others (not in group)
-S_IROTH = 00004 # others have read permission
-S_IWOTH = 00002 # others have write permission
-S_IXOTH = 00001 # others have execute permission
+S_IFMT = 0170000 # bitmask for the file type bitfields
+S_IFSOCK = 0140000 # socket
+S_IFLNK = 0120000 # symbolic link
+S_IFREG = 0100000 # regular file
+S_IFBLK = 0060000 # block device
+S_IFDIR = 0040000 # directory
+S_IFCHR = 0020000 # character device
+S_IFIFO = 0010000 # fifo
+S_ISUID = 0004000 # set UID bit
+S_ISGID = 0002000 # set GID bit (see below)
+S_ISVTX = 0001000 # sticky bit (see below)
+S_IRWXU = 00700 # mask for file owner permissions
+S_IRUSR = 00400 # owner has read permission
+S_IWUSR = 00200 # owner has write permission
+S_IXUSR = 00100 # owner has execute permission
+S_IRWXG = 00070 # mask for group permissions
+S_IRGRP = 00040 # group has read permission
+S_IWGRP = 00020 # group has write permission
+S_IXGRP = 00010 # group has execute permission
+S_IRWXO = 00007 # mask for permissions for others (not in group)
+S_IROTH = 00004 # others have read permission
+S_IWOTH = 00002 # others have write permission
+S_IXOTH = 00001 # others have execute permission
+
class DirEntry(object):
"""
@@ -208,10 +217,11 @@ class DirEntry(object):
self.longname = longname
self.attrs = attrs
+
class FileHandle(object):
- def __init__(self, service, id):
+ def __init__(self, service, fileID):
self.service = service
- self.id = id
+ self.id = fileID
def getService(self):
return self.service
@@ -234,15 +244,18 @@ STATUS_NO_SUCH_FILE = 0x10002
# permissions to perform the operation.
STATUS_PERMISSION_DENIED = 0x10003
+
class FileSystemException(IOError):
"""
The class to represent File System error reports.
"""
+
def __init__(self, message_or_exception):
if isinstance(message_or_exception, (str, unicode)):
super(FileSystemException, self).__init__(message_or_exception)
elif isinstance(message_or_exception, Exception):
self.caused_by = message_or_exception
+
def getStatus(self):
"""
Get error code. The code can be standard TCF error code or
@@ -251,19 +264,23 @@ class FileSystemException(IOError):
"""
raise NotImplementedError("Abstract methods")
+
class FileSystemService(services.Service):
+
def getName(self):
return NAME
- def open(self, file_name, flags, attrs, done):
+ def open(self, file_name, flags, attrs, done): # @ReservedAssignment
"""
Open or create a file on a remote system.
- @param file_name specifies the file name. See 'File Names' for more information.
- @param flags is a bit mask of TCF_O_* flags.
- @param attrs specifies the initial attributes for the file.
- Default values will be used for those attributes that are not specified.
- @param done is call back object.
+ @param file_name - specifies the file name. See 'File Names' for more
+ information.
+ @param flags - is a bit mask of TCF_O_* flags.
+ @param attrs - specifies the initial attributes for the file. Default
+ values will be used for those attributes that are not
+ specified.
+ @param done - is call back object.
@return pending command handle.
"""
raise NotImplementedError("Abstract methods")
@@ -285,18 +302,19 @@ class FileSystemService(services.Service):
In response to this request, the server will read as many bytes as it
can from the file (up to 'length'), and return them in a byte array.
If an error occurs or EOF is encountered, the server may return
- fewer bytes then requested. Call back method doneRead() argument 'error'
- will be not None in case of error, and argument 'eof' will be
+ fewer bytes then requested. Call back method doneRead() argument
+ 'error' will be not None in case of error, and argument 'eof' will be
True in case of EOF. For normal disk files, it is guaranteed
that this will read the specified number of bytes, or up to end of file
- or error. For e.g. device files this may return fewer bytes than requested.
-
- @param handle is an open file handle returned by open().
- @param offset is the offset (in bytes) relative
- to the beginning of the file from where to start reading.
- If offset < 0 then reading starts from current position in the file.
- @param length is the maximum number of bytes to read.
- @param done is call back object.
+ or error. For e.g. device files this may return fewer bytes than
+ requested.
+
+ @param handle - is an open file handle returned by open().
+ @param offset - is the offset (in bytes) relative to the beginning of
+ the file from where to start reading. If offset < 0
+ then reading starts from current position in the file.
+ @param length - is the maximum number of bytes to read.
+ @param done - is call back object.
@return pending command handle.
"""
raise NotImplementedError("Abstract methods")
@@ -346,7 +364,8 @@ class FileSystemService(services.Service):
def fstat(self, handle, done):
"""
- Retrieve file attributes for an open file (identified by the file handle).
+ Retrieve file attributes for an open file (identified by the file
+ handle).
@param handle is a file handle returned by 'open()'.
@param done is call back object.
@@ -393,7 +412,8 @@ class FileSystemService(services.Service):
directory, it SHOULD call close() for the handle. The handle
should be closed regardless of whether an error has occurred or not.
- @param path - name of the directory to be listed (without any trailing slash).
+ @param path - name of the directory to be listed (without any trailing
+ slash).
@param done - result call back object.
@return pending command handle.
"""
@@ -444,12 +464,14 @@ class FileSystemService(services.Service):
def roots(self, done):
"""
Retrieve file system roots - top level file system objects.
- UNIX file system can report just one root with path "/". Other types of systems
- can have more the one root. For example, Windows server can return multiple roots:
- one per disc (e.g. "/C:/", "/D:/", etc.). Note: even Windows implementation of
- the service must use forward slash as directory separator, and must start
- absolute path with "/". Server should implement proper translation of
- protocol file names to OS native names and back.
+ UNIX file system can report just one root with path "/". Other types of
+ systems can have more the one root. For example, Windows server can
+ return multiple roots:
+ one per disc (e.g. "/C:/", "/D:/", etc.). Note: even Windows
+ implementation of the service must use forward slash as directory
+ separator, and must start absolute path with "/". Server should
+ implement proper translation of protocol file names to OS native names
+ and back.
@param done - result call back object.
@return pending command handle.
@@ -508,8 +530,9 @@ class FileSystemService(services.Service):
"""
Create a symbolic link on the server.
- @param link_path specifies the path name of the symbolic link to be created.
- @param target_path specifies the target of the symbolic link.
+ @param link_path - specifies the path name of the symbolic link to be
+ created.
+ @param target_path - specifies the target of the symbolic link.
@param done - result call back object.
@return pending command handle.
"""
@@ -519,8 +542,8 @@ class FileSystemService(services.Service):
"""
Copy a file on remote system.
- @param src_path specifies the path name of the file to be copied.
- @param dst_path specifies destination file name.
+ @param src_path - specifies the path name of the file to be copied.
+ @param dst_path - specifies destination file name.
@param copy_permissions - if True then copy source file permissions.
@param copy_ownership - if True then copy source file UID and GID.
@param done - result call back object.
@@ -538,66 +561,83 @@ class FileSystemService(services.Service):
"""
raise NotImplementedError("Abstract methods")
+
class DoneOpen(object):
def doneOpen(self, token, error, handle):
pass
+
class DoneClose(object):
def doneClose(self, token, error):
pass
+
class DoneRead(object):
def doneRead(self, token, error, data, eof):
pass
+
class DoneWrite(object):
def doneWrite(self, token, error):
pass
+
class DoneStat(object):
def doneStat(self, token, error, attrs):
pass
+
class DoneSetStat(object):
def doneSetStat(self, token, error):
pass
+
class DoneReadDir(object):
def doneReadDir(self, token, error, entries, eof):
pass
+
class DoneMkDir(object):
def doneMkDir(self, token, error):
pass
+
class DoneRemove(object):
def doneRemove(self, token, error):
pass
+
class DoneRoots(object):
def doneRoots(self, token, error, entries):
pass
+
class DoneRealPath(object):
def doneRealPath(self, token, error, path):
pass
+
class DoneRename(object):
def doneRename(self, token, error):
pass
+
class DoneReadLink(object):
def doneReadLink(self, token, error, path):
pass
+
class DoneSymLink(object):
def doneSymLink(self, token, error):
pass
+
class DoneCopy(object):
def doneCopy(self, token, error):
pass
+
class DoneUser(object):
- def doneUser(self, token, error, real_uid, effective_uid, real_gid, effective_gid, home):
+ def doneUser(self, token, error, real_uid, effective_uid, real_gid,
+ effective_gid, home):
pass
diff --git a/python/src/tcf/services/linenumbers.py b/python/src/tcf/services/linenumbers.py
index fe3703d..422515b 100644
--- a/python/src/tcf/services/linenumbers.py
+++ b/python/src/tcf/services/linenumbers.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,17 +7,18 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
-Line numbers service associates locations in the source files with the corresponding
-machine instruction addresses in the executable object.
+Line numbers service associates locations in the source files with the
+corresponding machine instruction addresses in the executable object.
"""
from tcf import services
NAME = "LineNumbers"
+
class CodeArea(object):
"""
A CodeArea represents a continues area in source text mapped to
@@ -28,11 +29,11 @@ class CodeArea(object):
File and directory names are valid on a host where code was compiled.
It is client responsibility to map names to local host file system.
"""
- def __init__(self, directory, file, start_line, start_column,
- end_line, end_column, start_address, end_address, isa,
- is_statement, basic_block, prologue_end, epilogue_begin):
+ def __init__(self, directory, fileName, start_line, start_column,
+ end_line, end_column, start_address, end_address, isa,
+ is_statement, basic_block, prologue_end, epilogue_begin):
self.directory = directory
- self.file = file
+ self.file = fileName
self.start_line = start_line
self.start_column = start_column
self.end_line = end_line
@@ -46,27 +47,44 @@ class CodeArea(object):
self.epilogue_begin = epilogue_begin
def __eq__(self, o):
- if self is o: return True
- if not isinstance(o, CodeArea): return False
- if self.start_line != o.start_line: return False
- if self.start_column != o.start_column: return False
- if self.end_line != o.end_line: return False
- if self.end_column != o.end_column: return False
- if self.isa != o.isa: return False
- if self.is_statement != o.is_statement: return False
- if self.basic_block != o.basic_block: return False
- if self.prologue_end != o.prologue_end: return False
- if self.epilogue_begin != o.epilogue_begin: return False
- if self.start_address != o.start_address: return False
- if self.end_address != o.end_address: return False
- if self.file != o.file: return False
- if self.directory != o.directory: return False
+ if self is o:
+ return True
+ if not isinstance(o, CodeArea):
+ return False
+ if self.start_line != o.start_line:
+ return False
+ if self.start_column != o.start_column:
+ return False
+ if self.end_line != o.end_line:
+ return False
+ if self.end_column != o.end_column:
+ return False
+ if self.isa != o.isa:
+ return False
+ if self.is_statement != o.is_statement:
+ return False
+ if self.basic_block != o.basic_block:
+ return False
+ if self.prologue_end != o.prologue_end:
+ return False
+ if self.epilogue_begin != o.epilogue_begin:
+ return False
+ if self.start_address != o.start_address:
+ return False
+ if self.end_address != o.end_address:
+ return False
+ if self.file != o.file:
+ return False
+ if self.directory != o.directory:
+ return False
return True
def __hash__(self):
h = 0
- if file: h += hash(file)
- return h + self.start_line + self.start_column + self.end_line + self.end_column
+ if self.file:
+ h += hash(self.file)
+ return h + self.start_line + self.start_column + self.end_line + \
+ self.end_column
def __str__(self):
import cStringIO
@@ -113,20 +131,24 @@ class CodeArea(object):
bf.write(']')
return bf.getvalue()
+
class LineNumbersService(services.Service):
+
def getName(self):
return NAME
def mapToSource(self, context_id, start_address, end_address, done):
raise NotImplementedError("Abstract method")
- def mapToMemory(self, context_id, file, line, column, done):
+ def mapToMemory(self, context_id, fileName, line, column, done):
raise NotImplementedError("Abstract method")
+
class DoneMapToSource(object):
def doneMapToSource(self, token, error, areas):
pass
+
class DoneMapToMemory(object):
def doneMapToMemory(self, token, error, areas):
pass
diff --git a/python/src/tcf/services/locator.py b/python/src/tcf/services/locator.py
index 51006cb..c5c9d97 100644
--- a/python/src/tcf/services/locator.py
+++ b/python/src/tcf/services/locator.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,23 +7,25 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
-Locator service uses transport layer to search for peers and to collect data about
-peer's attributes and capabilities (services). Discovery mechanism depends on transport protocol
-and is part of that protocol handler. Targets, known to other hosts, can be found through
-remote instances of Locator service. Automatically discovered targets require no further
-configuration. Additional targets can be configured manually.
+Locator service uses transport layer to search for peers and to collect data
+about peer's attributes and capabilities (services). Discovery mechanism
+depends on transport protocol and is part of that protocol handler. Targets,
+known to other hosts, can be found through remote instances of Locator service.
+Automatically discovered targets require no further configuration. Additional
+targets can be configured manually.
Clients should use protocol.getLocator() to obtain local instance of locator,
-then locator.getPeers() can be used to get list of available peers (hosts and targets).
+then locator.getPeers() can be used to get list of available peers (hosts and
+targets).
"""
from tcf import services
# Peer data retention period in milliseconds.
-DATA_RETENTION_PERIOD = 60 * 1000;
+DATA_RETENTION_PERIOD = 60 * 1000
# Auto-configuration protocol version.
CONF_VERSION = '2'
@@ -37,58 +39,76 @@ CONF_PEERS_REMOVED = 5
NAME = "Locator"
+
class LocatorService(services.Service):
+
def getName(self):
return NAME
+
def getPeers(self):
"""
Get map (ID -> IPeer) of available peers (hosts and targets).
- The method return cached (currently known to the framework) list of peers.
- The list is updated according to event received from transport layer
+ The method return cached (currently known to the framework) list of
+ peers. The list is updated according to event received from transport
+ layer.
"""
raise NotImplementedError("Abstract method")
+
def redirect(self, peer, done):
"""
- Redirect this service channel to given peer using this service as a proxy.
+ Redirect this service channel to given peer using this service as a
+ proxy.
@param peer - Peer ID or attributes map.
"""
raise NotImplementedError("Abstract method")
+
def sync(self, done):
"""
- Call back after TCF messages sent to this target up to this moment are delivered.
- This method is intended for synchronization of messages
- across multiple channels.
+ Call back after TCF messages sent to this target up to this moment are
+ delivered.
+ This method is intended for synchronization of messages across multiple
+ channels.
- Note: Cross channel synchronization can reduce performance and throughput.
- Most clients don't need channel synchronization and should not call this method.
+ Note: Cross channel synchronization can reduce performance and
+ throughput. Most clients don't need channel synchronization and
+ should not call this method.
- @param done will be executed by dispatch thread after communication
- messages are delivered to corresponding targets.
+ @param done - will be executed by dispatch thread after communication
+ messages are delivered to corresponding targets.
This is internal API, TCF clients should use module 'tcf.protocol'.
"""
raise NotImplementedError("Abstract method")
+
def addListener(self, listener):
"Add a listener for Locator service events."
raise NotImplementedError("Abstract method")
+
def removeListener(self, listener):
"Remove a listener for Locator service events."
raise NotImplementedError("Abstract method")
+
class DoneRedirect(object):
def doneRedirect(self, token, error):
pass
+
class DoneSync(object):
def doneSync(self, token):
pass
+
class LocatorListener(object):
+
def peerAdded(self, peer):
pass
+
def peerChanged(self, peer):
pass
- def peerRemoved(self, id):
+
+ def peerRemoved(self, peerID):
pass
- def peerHeartBeat(self, id):
+
+ def peerHeartBeat(self, peerID):
pass
diff --git a/python/src/tcf/services/memory.py b/python/src/tcf/services/memory.py
index 40a0c00..2bdc4fc 100644
--- a/python/src/tcf/services/memory.py
+++ b/python/src/tcf/services/memory.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
Memory service provides basic operations to read/write memory on a target.
@@ -18,34 +18,72 @@ from tcf import services
NAME = "Memory"
# Context property names.
-PROP_ID = "ID" # String, ID of the context, same as getContext command argument
-PROP_PARENT_ID = "ParentID" # String, ID of a parent context
-PROP_PROCESS_ID = "ProcessID" # String, process ID, see Processes service
-PROP_BIG_ENDIAN = "BigEndian" # Boolean, True if memory is big-endian
-PROP_ADDRESS_SIZE = "AddressSize" # Number, size of memory address in bytes
-PROP_NAME = "Name" # String, name of the context, can be used for UI purposes
-PROP_START_BOUND = "StartBound" # Number, lowest address (inclusive) which is valid for the context
-PROP_END_BOUND = "EndBound" # Number, highest address (inclusive) which is valid for the context
-PROP_ACCESS_TYPES = "AccessTypes" # Array of String, the access types allowed for this context
+# String, ID of the context, same as getContext command argument
+PROP_ID = "ID"
+
+# String, ID of a parent context
+PROP_PARENT_ID = "ParentID"
+
+# String, process ID, see Processes service
+PROP_PROCESS_ID = "ProcessID"
+
+# Boolean, True if memory is big-endian
+PROP_BIG_ENDIAN = "BigEndian"
+
+# Number, size of memory address in bytes
+PROP_ADDRESS_SIZE = "AddressSize"
+
+# String, name of the context, can be used for UI purposes
+PROP_NAME = "Name"
+
+# Number, lowest address (inclusive) which is valid for the context
+PROP_START_BOUND = "StartBound"
+
+# Number, highest address (inclusive) which is valid for the context
+PROP_END_BOUND = "EndBound"
+
+# Array of String, the access types allowed for this context
+PROP_ACCESS_TYPES = "AccessTypes"
# Values of "AccessTypes".
-# Target system can support multiple different memory access types, like instruction and data access.
-# Different access types can use different logic for address translation and memory mapping, so they can
-# end up accessing different data bits, even if address is the same.
+# Target system can support multiple different memory access types, like
+# instruction and data access. Different access types can use different logic
+# for address translation and memory mapping, so they can end up accessing
+# different data bits, even if address is the same.
# Each distinct access type should be represented by separate memory context.
-# A memory context can represent multiple access types if they are equivalent - all access same memory bits.
+# A memory context can represent multiple access types if they are
+# equivalent - all access same memory bits.
# Same data bits can be exposed through multiple memory contexts.
-ACCESS_INSTRUCTION = "instruction" # Context represent instructions fetch access
-ACCESS_DATA = "data" # Context represents data access
-ACCESS_IO = "io" # Context represents IO peripherals
-ACCESS_USER = "user" # Context represents a user (e.g. application running in Linux) view to memory
-ACCESS_SUPERVISOR = "supervisor" # Context represents a supervisor (e.g. Linux kernel) view to memory
-ACCESS_HYPERVISOR = "hypervisor" # Context represents a hypervisor view to memory
-ACCESS_VIRTUAL = "virtual" # Context uses virtual addresses
-ACCESS_PHYSICAL = "physical" # Context uses physical addresses
-ACCESS_CACHE = "cache" # Context is a cache
-ACCESS_TLB = "tlb" # Context is a TLB memory
+# Context represent instructions fetch access
+ACCESS_INSTRUCTION = "instruction"
+
+# Context represents data access
+ACCESS_DATA = "data"
+
+# Context represents IO peripherals
+ACCESS_IO = "io"
+
+# Context represents a user (e.g. application running in Linux) view to memory
+ACCESS_USER = "user"
+
+# Context represents a supervisor (e.g. Linux kernel) view to memory
+ACCESS_SUPERVISOR = "supervisor"
+
+# Context represents a hypervisor view to memory
+ACCESS_HYPERVISOR = "hypervisor"
+
+# Context uses virtual addresses
+ACCESS_VIRTUAL = "virtual"
+
+# Context uses physical addresses
+ACCESS_PHYSICAL = "physical"
+
+# Context is a cache
+ACCESS_CACHE = "cache"
+
+# Context is a TLB memory
+ACCESS_TLB = "tlb"
# Memory access mode:
# Carry on when some of the memory cannot be accessed and
@@ -57,7 +95,9 @@ MODE_CONTINUEONERROR = 0x1
# Verify result of memory operations (by reading and comparing).
MODE_VERIFY = 0x2
+
class MemoryContext(object):
+
def __init__(self, props):
self._props = props or {}
@@ -67,7 +107,8 @@ class MemoryContext(object):
def getProperties(self):
"""
Get context properties. See PROP_* definitions for property names.
- Context properties are read only, clients should not try to modify them.
+ Context properties are read only, clients should not try to modify
+ them.
@return Map of context properties.
"""
return self._props
@@ -136,10 +177,10 @@ class MemoryContext(object):
"""
return self._props.get(PROP_ACCESS_TYPES)
- def set(self, addr, word_size, buf, offs, size, mode, done):
+ def set(self, addr, ws, buf, offs, sz, mode, done): # @ReservedAssignment
"""
Set target memory.
- If 'word_size' is 0 it means client does not care about word size.
+ If 'ws' is 0 it means client does not care about word size.
"""
raise NotImplementedError("Abstract method")
@@ -156,6 +197,7 @@ class MemoryContext(object):
"""
raise NotImplementedError("Abstract method")
+
class DoneMemory(object):
"""
Client call back interface for set(), get() and fill() commands.
@@ -163,9 +205,11 @@ class DoneMemory(object):
def doneMemory(self, token, error):
pass
-class MemoryError(Exception):
+
+class MemoryError(Exception): # @ReservedAssignment
pass
+
class ErrorOffset(object):
"""
ErrorOffset may be implemented by MemoryError object,
@@ -179,16 +223,16 @@ class ErrorOffset(object):
possible reasons of partial memory operation.
"""
# Error may have per byte information
- BYTE_VALID = 0x00
- BYTE_UNKNOWN = 0x01 # e.g. out of range
- BYTE_INVALID = 0x02
- BYTE_CANNOT_READ = 0x04
+ BYTE_VALID = 0x00
+ BYTE_UNKNOWN = 0x01 # e.g. out of range
+ BYTE_INVALID = 0x02
+ BYTE_CANNOT_READ = 0x04
BYTE_CANNOT_WRITE = 0x08
- RANGE_KEY_ADDR = "addr"
- RANGE_KEY_SIZE = "size"
- RANGE_KEY_STAT = "stat"
- RANGE_KEY_MSG = "msg"
+ RANGE_KEY_ADDR = "addr"
+ RANGE_KEY_SIZE = "size"
+ RANGE_KEY_STAT = "stat"
+ RANGE_KEY_MSG = "msg"
def getStatus(self, offset):
raise NotImplementedError("Abstract method")
@@ -196,15 +240,17 @@ class ErrorOffset(object):
def getMessage(self, offset):
raise NotImplementedError("Abstract method")
+
class MemoryService(services.Service):
+
def getName(self):
return NAME
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
"""
Retrieve context info for given context ID.
- @param id - context ID.
+ @param contextID - context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
@@ -213,17 +259,20 @@ class MemoryService(services.Service):
def getChildren(self, parent_context_id, done):
"""
Retrieve contexts available for memory commands.
- A context corresponds to an execution thread, process, address space, etc.
- A context can belong to a parent context. Contexts hierarchy can be simple
- plain list or it can form a tree. It is up to target agent developers to choose
- layout that is most descriptive for a given target. Context IDs are valid across
- all services. In other words, all services access same hierarchy of contexts,
- with same IDs, however, each service accesses its own subset of context's
- attributes and functionality, which is relevant to that service.
-
- @param parent_context_id - parent context ID. Can be None -
- to retrieve top level of the hierarchy, or one of context IDs retrieved
- by previous getChildren commands.
+ A context corresponds to an execution thread, process, address space,
+ etc.
+ A context can belong to a parent context. Contexts hierarchy can be
+ simple plain list or it can form a tree. It is up to target agent
+ developers to choose layout that is most descriptive for a given
+ target. Context IDs are valid across all services. In other words, all
+ services access same hierarchy of contexts, with same IDs, however,
+ each service accesses its own subset of context's attributes and
+ functionality, which is relevant to that service.
+
+ @param parent_context_id - parent context ID. Can be None - to retrieve
+ top level of the hierarchy, or one of
+ context IDs retrieved by previous
+ getChildren commands.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
@@ -243,6 +292,7 @@ class MemoryService(services.Service):
"""
raise NotImplementedError("Abstract method")
+
class MemoryListener(object):
"""
Memory event listener is notified when memory context hierarchy
@@ -278,6 +328,7 @@ class MemoryListener(object):
"""
pass
+
class DoneGetContext(object):
"""
Client call back interface for getContext().
@@ -285,11 +336,13 @@ class DoneGetContext(object):
def doneGetContext(self, token, error, context):
"""
Called when context data retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context data.
"""
pass
+
class DoneGetChildren(object):
"""
Client call back interface for getChildren().
@@ -297,7 +350,8 @@ class DoneGetChildren(object):
def doneGetChildren(self, token, error, context_ids):
"""
Called when context list retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
"""
pass
diff --git a/python/src/tcf/services/memorymap.py b/python/src/tcf/services/memorymap.py
index 49c9d4b..b8cca9e 100644
--- a/python/src/tcf/services/memorymap.py
+++ b/python/src/tcf/services/memorymap.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,10 +7,11 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
-MemoryMap service provides information about executable modules (files) mapped (loaded) into target memory.
+MemoryMap service provides information about executable modules (files) mapped
+(loaded) into target memory.
"""
from tcf import services
@@ -22,6 +23,12 @@ NAME = "MemoryMap"
# Number, region address in memory
PROP_ADDRESS = "Addr"
+# String, memory region context query, see IContextQuery
+PROP_CONTEXT_QUERY = "ContextQuery"
+
+# String, memory region ID
+PROP_ID = "ID"
+
# Number, region size
PROP_SIZE = "Size"
@@ -50,6 +57,7 @@ FLAG_WRITE = 2
# Instruction fetch access is allowed
FLAG_EXECUTE = 4
+
class MemoryRegion(object):
"""Memory region object."""
@@ -71,6 +79,15 @@ class MemoryRegion(object):
"""
return self._props.get(PROP_ADDRESS)
+ def getContextQuery(self):
+ """Get context query that defines scope of the region, see also
+ ContextQuery service.
+ Same as getProperties().get(PROP_CONTEXT_QUERY)
+ Only user-defined regions can have a context query property.
+ @return context query expression, or None.
+ """
+ return self._props.get(PROP_CONTEXT_QUERY, None)
+
def getSize(self):
"""
Get memory region size.
@@ -114,26 +131,28 @@ class MemoryRegion(object):
return "MemoryRegion(%s)" % str(self._props)
__str__ = __repr__
+
class MemoryMapService(services.Service):
+
def getName(self):
return NAME
- def get(self, id, done):
+ def get(self, contextID, done):
"""
Retrieve memory map for given context ID.
- @param id - context ID.
+ @param contextID - context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
return NotImplementedError("Abstract method")
- def set(self, id, map, done):
+ def set(self, contextID, memoryMap, done): # @ReservedAssignment
"""
Set memory map for given context ID.
- @param id - context ID.
- @param map - memory map data.
+ @param contextID - context ID.
+ @param memoryMap - memory map data.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
@@ -153,18 +172,21 @@ class MemoryMapService(services.Service):
"""
return NotImplementedError("Abstract method")
+
class DoneGet(object):
"""
Client call back interface for get().
"""
- def doneGet(self, token, error, map):
+ def doneGet(self, token, error, memoryMap):
"""
Called when memory map data retrieval is done.
- @param error - error description if operation failed, None if succeeded.
- @param map - memory map data.
+ @param error - error description if operation failed, None if
+ succeeded.
+ @param memoryMap - memory map data.
"""
pass
+
class DoneSet(object):
"""
Client call back interface for set().
@@ -172,10 +194,12 @@ class DoneSet(object):
def doneSet(self, token, error):
"""
Called when memory map set command is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
"""
pass
+
class MemoryMapListener(object):
"""
Service events listener interface.
diff --git a/python/src/tcf/services/pathmap.py b/python/src/tcf/services/pathmap.py
index 588818d..85de426 100644
--- a/python/src/tcf/services/pathmap.py
+++ b/python/src/tcf/services/pathmap.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
PathMap service manages file path translation across systems.
@@ -18,11 +18,9 @@ from tcf import services
NAME = "PathMap"
# Path mapping rule property names.
-# String, rule ID
-PROP_ID = "ID"
-# String, source, or compile-time file path
-PROP_SOURCE = "Source"
+# String, contexts query, see IContextQuery
+PROP_CONTEXT_QUERY = "ContextQuery"
# String, destination, or run-time file path
PROP_DESTINATION = "Destination"
@@ -30,9 +28,19 @@ PROP_DESTINATION = "Destination"
# String
PROP_HOST = "Host"
+# String, rule ID
+PROP_ID = "ID"
+
# String, file access protocol, see PROTOCOL_*, default is regular file
PROP_PROTOCOL = "Protocol"
+# String, source, or compile-time file path
+PROP_SOURCE = "Source"
+
+# Deprecated
+# String, symbols context group ID or name, deprecated - use ContextQuery
+PROP_CONTEXT = "Context"
+
# PROP_PROTOCOL values.
# Regular file access using system calls
PROTOCOL_FILE = "file"
@@ -43,6 +51,7 @@ PROTOCOL_HOST = "host"
# File should be accessed using File System service on target
PROTOCOL_TARGET = "target"
+
class PathMapRule(object):
"""
PathMapRule represents a single file path mapping rule.
@@ -56,10 +65,19 @@ class PathMapRule(object):
def __json__(self):
return self._props
+ def getContextQuery(self):
+ """Get context query that defines scope of the mapping rule, see
+ also IContextQuery.
+ Same as getProperties().get(PROP_CONTEXT_QUERY)
+ @return context query expression, or None.
+ """
+ return self._props.get(PROP_CONTEXT_QUERY, None)
+
def getProperties(self):
"""
Get rule properties. See PROP_* definitions for property names.
- Context properties are read only, clients should not try to modify them.
+ Context properties are read only, clients should not try to modify
+ them.
@return Map of rule properties.
"""
return self._props
@@ -118,28 +136,31 @@ class PathMapService(services.Service):
"""
return NotImplementedError("Abstract method")
- def set(self, map, done):
+ def set(self, pathMap, done): # @ReservedAssignment
"""
Set file path mapping rules.
- @param map - file path mapping rules.
+ @param pathMap - file path mapping rules.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
return NotImplementedError("Abstract method")
+
class DoneGet(object):
"""
Client call back interface for get().
"""
- def doneGet(self, token, error, map):
+ def doneGet(self, token, error, pathMap):
"""
Called when file path mapping retrieval is done.
- @param error - error description if operation failed, None if succeeded.
- @param map - file path mapping data.
+ @param error - error description if operation failed, None if
+ succeeded.
+ @param pathMap - file path mapping data.
"""
pass
+
class DoneSet(object):
"""
Client call back interface for set().
@@ -147,7 +168,8 @@ class DoneSet(object):
def doneSet(self, token, error):
"""
Called when file path mapping transmission is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param map - memory map data.
"""
pass
diff --git a/python/src/tcf/services/processes.py b/python/src/tcf/services/processes.py
index 8670fe2..2e990ee 100644
--- a/python/src/tcf/services/processes.py
+++ b/python/src/tcf/services/processes.py
@@ -1,4 +1,4 @@
-# *******************************************************************************
+# *****************************************************************************
# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
IProcesses service provides access to the target OS's process
@@ -71,18 +71,21 @@ class ProcessesService(services.Service):
def getName(self):
return NAME
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
"""
Retrieve context info for given context ID.
- A context corresponds to an execution thread, process, address space, etc.
+ A context corresponds to an execution thread, process, address space,
+ etc.
+
Context IDs are valid across TCF services, so it is allowed to issue
- 'IProcesses.getContext' command with a context that was obtained,
- for example, from Memory service.
- However, 'Processes.getContext' is supposed to return only process specific data,
- If the ID is not a process ID, 'IProcesses.getContext' may not return any
- useful information
+ getContext() command with a context that was obtained, for example,
+ from Memory service.
+
+ However, 'Processes.getContext' is supposed to return only process
+ specific data, If the ID is not a process ID, 'Processes.getContext'
+ may not return any useful information
- @param id - context ID.
+ @param contextID - context ID.
@param done - call back interface called when operation is completed.
"""
raise NotImplementedError("Abstract method")
@@ -124,9 +127,11 @@ class ProcessesService(services.Service):
Set process or thread signal mask.
Bits in the mask control how signals should be handled by debug agent.
If context is not attached the command will return an error.
- @param dont_stop - bit-set of signals that should not suspend execution of the context.
+ @param dont_stop - bit-set of signals that should not suspend execution
+ of the context.
By default, debugger suspends a context before it receives a signal.
- @param dont_pass - bit-set of signals that should not be delivered to the context.
+ @param dont_pass - bit-set of signals that should not be delivered to
+ the context.
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
@@ -150,16 +155,20 @@ class ProcessesService(services.Service):
"""
raise NotImplementedError("Abstract method")
- def start(self, directory, file, command_line, environment, attach, done):
+ def start(self, directory, fileName, command_line, environment, attach,
+ done):
"""
Start a new process on remote machine.
@param directory - initial value of working directory for the process.
- @param file - process image file.
+ @param fileName - process image file.
@param command_line - command line arguments for the process.
- Note: the service does NOT add image file name as first argument for the process.
- If a client wants first parameter to be the file name, it should add it itself.
+ Note: the service does NOT add image file name as
+ first argument for the process. If a client wants
+ first parameter to be the file name, it should
+ add it itself.
@param environment - map of environment variables for the process,
- if None then default set of environment variables will be used.
+ if None then default set of environment variables
+ will be used.
@param attach - if True debugger should be attached to the process.
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
@@ -191,7 +200,8 @@ class ProcessContext(object):
def getProperties(self):
"""
Get context properties. See PROP_* definitions for property names.
- Context properties are read only, clients should not try to modify them.
+ Context properties are read only, clients should not try to modify
+ them.
@return Map of context properties.
"""
return self._props
@@ -220,7 +230,8 @@ class ProcessContext(object):
def isAttached(self):
"""
Utility method to read context property PROP_ATTACHED.
- Services like IRunControl, IMemory, IBreakpoints work only with attached processes.
+ Services like RunControl, Memory, Breakpoints work only with
+ attached processes.
@return value of PROP_ATTACHED.
"""
return bool(self._props.get(PROP_ATTACHED))
@@ -235,7 +246,8 @@ class ProcessContext(object):
def attach(self, done):
"""
Attach debugger to a process.
- Services like IRunControl, IMemory, IBreakpoints work only with attached processes.
+ Services like RunControl, Memory, Breakpoints work only with attached
+ processes.
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
@@ -258,6 +270,7 @@ class ProcessContext(object):
"""
raise NotImplementedError("Abstract method")
+
class DoneCommand(object):
"""
Call-back interface to be called when command is complete.
@@ -265,6 +278,7 @@ class DoneCommand(object):
def doneCommand(self, token, error):
pass
+
class DoneGetContext(object):
"""
Client call back interface for getContext().
@@ -272,11 +286,13 @@ class DoneGetContext(object):
def doneGetContext(self, token, error, context):
"""
Called when context data retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context data.
"""
pass
+
class DoneGetChildren(object):
"""
Client call back interface for getChildren().
@@ -284,18 +300,21 @@ class DoneGetChildren(object):
def doneGetChildren(self, token, error, context_ids):
"""
Called when context list retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
"""
pass
+
class DoneGetSignalList(object):
"""
Call-back interface to be called when "getSignalList" command is complete.
"""
- def doneGetSignalList(self, token, error, list):
+ def doneGetSignalList(self, token, error, signalList):
pass
+
class DoneGetSignalMask(object):
"""
Call-back interface to be called when "getSignalMask" command is complete.
@@ -303,13 +322,17 @@ class DoneGetSignalMask(object):
def doneGetSignalMask(self, token, error, dont_stop, dont_pass, pending):
"""
@param token - command handle.
- @param dont_stop - bit-set of signals that should suspend execution of the context.
- @param dont_pass - bit-set of signals that should not be delivered to the context.
- @param pending - bit-set of signals that are generated but not delivered yet.
+ @param dont_stop - bit-set of signals that should suspend execution of
+ the context.
+ @param dont_pass - bit-set of signals that should not be delivered to
+ the context.
+ @param pending - bit-set of signals that are generated but not
+ delivered yet.
Note: "pending" is meaningful only if the context is suspended.
"""
pass
+
class DoneGetEnvironment(object):
"""
Call-back interface to be called when "getEnvironment" command is complete.
@@ -317,6 +340,7 @@ class DoneGetEnvironment(object):
def doneGetEnvironment(self, token, error, environment):
pass
+
class DoneStart(object):
"""
Call-back interface to be called when "start" command is complete.
@@ -324,6 +348,7 @@ class DoneStart(object):
def doneStart(self, token, error, process):
pass
+
class ProcessesListener(object):
"""
Process event listener is notified when a process exits.
@@ -334,7 +359,8 @@ class ProcessesListener(object):
"""
Called when a process exits.
@param process_id - process context ID
- @param exit_code - if >= 0 - the process exit code,
- if < 0 - process was terminated by a signal, the signal code = -exit_code.
+ @param exit_code - if >= 0 - the process exit code, if < 0 - process
+ was terminated by a signal, the signal
+ code = -exit_code.
"""
pass
diff --git a/python/src/tcf/services/registers.py b/python/src/tcf/services/registers.py
index dff4f4a..e9ab679 100644
--- a/python/src/tcf/services/registers.py
+++ b/python/src/tcf/services/registers.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
Registers service provides access to target CPU register values and properties.
@@ -18,44 +18,110 @@ from tcf import services
NAME = "Registers"
# Context property names.
-PROP_ID = "ID" # String, ID of the context
-PROP_PARENT_ID = "ParentID" # String, ID of a parent context
-PROP_PROCESS_ID = "ProcessID" # String, process ID
-PROP_NAME = "Name" # String, context name
-PROP_DESCRIPTION = "Description" # String, context description
-PROP_SIZE = "Size" # Number, context size in bytes. Byte arrays in get/set commands should be same size
-PROP_READBLE = "Readable" # Boolean, true if context value can be read
-PROP_READ_ONCE = "ReadOnce" # Boolean, true if reading the context (register) destroys its current value
-PROP_WRITEABLE = "Writeable" # Boolean, true if context value can be written
-PROP_WRITE_ONCE = "WriteOnce" # Boolean, true if register value can not be overwritten - every write counts
-PROP_SIDE_EFFECTS = "SideEffects" # Boolean, true if writing the context can change values of other registers
-PROP_VOLATILE = "Volatile" # Boolean, true if the register value can change even when target is stopped
-PROP_FLOAT = "Float" # Boolean, true if the register value is a floating-point value
-PROP_BIG_ENDIAN = "BigEndian" # Boolean, true if big endian
-PROP_LEFT_TO_RIGHT = "LeftToRight" # Boolean, true if the lowest numbered bit should be shown to user as the left-most bit
-PROP_FIST_BIT = "FirstBit" # Number, bit numbering base (0 or 1) to use when showing bits to user
-PROP_BITS = "Bits" # Number, if context is a bit field, contains the field bit numbers in the parent context
-PROP_VALUES = "Values" # Array of Map, predefined names (mnemonics) for some of context values
-PROP_MEMORY_ADDRESS = "MemoryAddress" # Number, the address of a memory mapped register
-PROP_MEMORY_CONTEXT = "MemoryContext" # String, the context ID of a memory context in which a memory mapped register is located
-PROP_CAN_SEARCH = "CanSearch" # Array of String, a list of attribute names which can be searched for starting on this context
-PROP_ROLE = "Role" # String, the role the register plays in a program execution
+# String, ID of the context
+PROP_ID = "ID"
+
+# String, ID of a parent context
+PROP_PARENT_ID = "ParentID"
+
+# String, process ID
+PROP_PROCESS_ID = "ProcessID"
+
+# String, context name
+PROP_NAME = "Name"
+
+# String, context description
+PROP_DESCRIPTION = "Description"
+
+# Number, context size in bytes. Byte arrays in get/set commands should be same
+# size
+PROP_SIZE = "Size"
+
+# Boolean, true if context value can be read
+PROP_READBLE = "Readable"
+
+# Boolean, true if reading the context (register) destroys its current value
+PROP_READ_ONCE = "ReadOnce"
+
+# Boolean, true if context value can be written
+PROP_WRITEABLE = "Writeable"
+
+# Boolean, true if register value can not be overwritten - every write counts
+PROP_WRITE_ONCE = "WriteOnce"
+
+# Boolean, true if writing the context can change values of other registers
+PROP_SIDE_EFFECTS = "SideEffects"
+
+# Boolean, true if the register value can change even when target is stopped
+PROP_VOLATILE = "Volatile"
+
+# Boolean, true if the register value is a floating-point value
+PROP_FLOAT = "Float"
+
+# Boolean, true if big endian
+PROP_BIG_ENDIAN = "BigEndian"
+
+# Boolean, true if the lowest numbered bit should be shown to user as the
+# left-most bit
+PROP_LEFT_TO_RIGHT = "LeftToRight"
+
+# Number, bit numbering base (0 or 1) to use when showing bits to user
+PROP_FIRST_BIT = "FirstBit"
+
+# Number, if context is a bit field, contains the field bit numbers in the
+# parent context
+PROP_BITS = "Bits"
+
+# Array of Map, predefined names (mnemonics) for some of context values
+PROP_VALUES = "Values"
+
+# Number, the address of a memory mapped register
+PROP_MEMORY_ADDRESS = "MemoryAddress"
+
+# String, the context ID of a memory context in which a memory mapped register
+# is located
+PROP_MEMORY_CONTEXT = "MemoryContext"
+
+# Array of String, a list of attribute names which can be searched for starting
+# on this context
+PROP_CAN_SEARCH = "CanSearch"
+
+# String, the role the register plays in a program execution
+PROP_ROLE = "Role"
+
+# Number, when present describes the offset in the data of the parent register
+# where the value of a field can be found.
+PROP_OFFSET = "Offset"
+
# Values of context property "Role".
-ROLE_PC = "PC" # Program counter. Defines instruction to execute next
-ROLE_SP = "SP" # Register defining the current stack pointer location
-ROLE_FP = "FP" # Register defining the current frame pointer location
-ROLE_RET = "RET" # Register used to store the return address for calls
-ROLE_CORE = "CORE" # Indicates register or register groups which belong to the core state
+# Program counter. Defines instruction to execute next
+ROLE_PC = "PC"
+
+# Register defining the current stack pointer location
+ROLE_SP = "SP"
+
+# Register defining the current frame pointer location
+ROLE_FP = "FP"
+
+# Register used to store the return address for calls
+ROLE_RET = "RET"
+
+# Indicates register or register groups which belong to the core state
+ROLE_CORE = "CORE"
# Search filter properties.
-SEARCH_NAME = "Name" # The name of the property this filter applies too
-SEARCH_EQUAL_VALUE = "EqualValue" # The value which is searched for
+# The name of the property this filter applies too
+SEARCH_NAME = "Name"
+
+# The value which is searched for
+SEARCH_EQUAL_VALUE = "EqualValue"
class RegistersContext(object):
"""
- RegistersContext objects represent register groups, registers and bit fields.
+ RegistersContext objects represent register groups, registers and bit
+ fields.
"""
def __init__(self, props):
self._props = props or {}
@@ -66,7 +132,8 @@ class RegistersContext(object):
def getProperties(self):
"""
Get context properties. See PROP_* definitions for property names.
- Context properties are read only, clients should not try to modify them.
+ Context properties are read only, clients should not try to modify
+ them.
@return Map of context properties.
"""
return self._props
@@ -111,8 +178,9 @@ class RegistersContext(object):
Get context size in bytes.
Byte arrays in get()/set() methods should be same size.
Hardware register can be smaller then this size, for example in case
- when register size is not an even number of bytes. In such case implementation
- should add/remove padding that consist of necessary number of zero bits.
+ when register size is not an even number of bytes. In such case
+ implementation should add/remove padding that consist of necessary
+ number of zero bits.
@return context size in bytes.
"""
return self._props.get(PROP_SIZE, 0)
@@ -170,8 +238,10 @@ class RegistersContext(object):
def isBigEndian(self):
"""
Check endianness of the context.
- Big endian means decreasing numeric significance with increasing bit number.
- The endianness is used to encode and decode values of get, getm, set and setm commands.
+ Big endian means decreasing numeric significance with increasing bit
+ number.
+ The endianness is used to encode and decode values of get, getm, set
+ and setm commands.
@return true if big endian.
"""
return self._props.get(PROP_BIG_ENDIAN)
@@ -179,8 +249,8 @@ class RegistersContext(object):
def isLeftToRight(self):
"""
Check if the lowest numbered bit (i.e. bit #0 or bit #1 depending on
- getFirstBitNumber() value) should be shown to user as the left-most bit or
- the right-most bit.
+ getFirstBitNumber() value) should be shown to user as the left-most bit
+ or the right-most bit.
@return true if the first bit is left-most bit.
"""
return self._props.get(PROP_LEFT_TO_RIGHT)
@@ -191,7 +261,7 @@ class RegistersContext(object):
can be zero-based or 1-based.
@return first bit position - 0 or 1.
"""
- return self._props.get(PROP_FIST_BIT, 0)
+ return self._props.get(PROP_FIRST_BIT, 0)
def getBitNumbers(self):
"""
@@ -217,14 +287,16 @@ class RegistersContext(object):
def getMemoryContext(self):
"""
- Get the context ID of a memory context in which a memory mapped register is located.
+ Get the context ID of a memory context in which a memory mapped
+ register is located.
@return memory context ID.
"""
return self._props.get(PROP_MEMORY_CONTEXT)
def canSearch(self):
"""
- Get a list of property names which can be searched for starting on this context
+ Get a list of property names which can be searched for starting on
+ this context
@return collection of property names.
"""
return self._props.get(PROP_CAN_SEARCH)
@@ -236,6 +308,14 @@ class RegistersContext(object):
"""
return self._props.get(PROP_ROLE)
+ def getOffset(self):
+ """
+ Get the offset in the data of the parent register where the value of a
+ field can be found.
+ @return Register offset in parent register.
+ """
+ return self._props.get(PROP_OFFSET)
+
def get(self, done):
"""
Read value of the context.
@@ -244,7 +324,7 @@ class RegistersContext(object):
"""
raise NotImplementedError("Abstract method")
- def set(self, value, done):
+ def set(self, value, done): # @ReservedAssignment
"""
Set value of the context.
@param value - value to write into the context.
@@ -253,11 +333,12 @@ class RegistersContext(object):
"""
raise NotImplementedError("Abstract method")
- def search(self, filter, done):
+ def search(self, filterProps, done):
"""
Search register contexts that passes given search filter.
- Search is only supported for properties listed in the "CanSearch" property.
- @param filter - properties bag that defines search filter.
+ Search is only supported for properties listed in the "CanSearch"
+ property.
+ @param filterProps - properties bag that defines search filter.
@param done - call back object.
@return - pending command handle.
"""
@@ -268,11 +349,11 @@ class RegistersService(services.Service):
def getName(self):
return NAME
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
"""
Retrieve context info for given context ID.
- @param id - context ID.
+ @param contextID - context ID.
@param done - call back interface called when operation is completed.
"""
raise NotImplementedError("Abstract method")
@@ -280,17 +361,20 @@ class RegistersService(services.Service):
def getChildren(self, parent_context_id, done):
"""
Retrieve contexts available for registers commands.
- A context corresponds to an execution thread, stack frame, registers group, etc.
- A context can belong to a parent context. Contexts hierarchy can be simple
- plain list or it can form a tree. It is up to target agent developers to choose
- layout that is most descriptive for a given target. Context IDs are valid across
- all services. In other words, all services access same hierarchy of contexts,
- with same IDs, however, each service accesses its own subset of context's
- attributes and functionality, which is relevant to that service.
+ A context corresponds to an execution thread, stack frame, registers
+ group, etc.
+ A context can belong to a parent context. Contexts hierarchy can be
+ simple plain list or it can form a tree. It is up to target agent
+ developers to choose layout that is most descriptive for a given
+ target. Context IDs are valid across all services. In other words, all
+ services access same hierarchy of contexts, with same IDs, however,
+ each service accesses its own subset of context's attributes and
+ functionality, which is relevant to that service.
@param parent_context_id - parent context ID. Can be None -
- to retrieve top level of the hierarchy, or one of context IDs retrieved
- by previous getChildren commands.
+ to retrieve top level of the hierarchy, or
+ one of context IDs retrieved by previous
+ getChildren commands.
@param done - call back interface called when operation is completed.
"""
raise NotImplementedError("Abstract method")
@@ -331,7 +415,8 @@ class RegistersService(services.Service):
class NamedValue(object):
"""
- A register context can have predefined names (mnemonics) for some its values.
+ A register context can have predefined names (mnemonics) for some its
+ values.
NamedValue objects represent such values.
"""
def __init__(self, value, name, description):
@@ -360,6 +445,7 @@ class NamedValue(object):
"""
return self.description
+
class DoneGet(object):
"""
'get' command call back interface.
@@ -368,11 +454,13 @@ class DoneGet(object):
"""
Called when value retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param value - context value as array of bytes.
"""
pass
+
class DoneSet(object):
"""
'set' command call back interface.
@@ -381,10 +469,12 @@ class DoneSet(object):
"""
Called when value setting is done.
@param token - command handle.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
"""
pass
+
class DoneSearch(object):
"""
'search' command call back interface.
@@ -393,21 +483,26 @@ class DoneSearch(object):
"""
Called when context search is done.
@param token - command handle.
- @param error - error description if operation failed, None if succeeded.
- @param paths - array of paths to each context with properties matching the filter
+ @param error - error description if operation failed, None if
+ succeeded.
+ @param paths - array of paths to each context with properties matching
+ the filter
"""
pass
+
class DoneGetContext(object):
def doneGetContext(self, token, error, context):
"""
Called when context data retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context data.
"""
pass
+
class DoneGetChildren(object):
"""
Client call back interface for getChildren().
@@ -416,7 +511,8 @@ class DoneGetChildren(object):
"""
Called when context list retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
"""
pass
@@ -438,7 +534,7 @@ class RegistersListener(object):
"""
pass
- def registerChanged(self, id):
+ def registerChanged(self, contextID):
"""
Called when register content was changed and clients
need to update themselves. Clients, at least, should invalidate
@@ -446,7 +542,7 @@ class RegistersListener(object):
Not every change is notified - it is not possible,
only those, which are not caused by normal execution of the debuggee.
At least, changes caused by "set" command should be notified.
- @param id - register context ID.
+ @param contextID - register context ID.
"""
pass
@@ -455,13 +551,14 @@ class Location(object):
"""
Class Location represents value location in register context
"""
- def __init__(self, id, offs, size):
+ def __init__(self, contextID, offs, size):
# Register context ID
- self.id = id
+ self.id = contextID
# offset in the context, in bytes
self.offs = offs
# value size in bytes
self.size = size
+
def __iter__(self):
yield self.id
yield self.offs
diff --git a/python/src/tcf/services/remote/DisassemblyProxy.py b/python/src/tcf/services/remote/DisassemblyProxy.py
index 205f28d..867c19b 100644
--- a/python/src/tcf/services/remote/DisassemblyProxy.py
+++ b/python/src/tcf/services/remote/DisassemblyProxy.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,21 +7,29 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
from tcf.services import disassembly
from tcf.channel.Command import Command
+
class DisassemblyProxy(disassembly.DisassemblyService):
+
def __init__(self, channel):
self.channel = channel
def getCapabilities(self, context_id, done):
done = self._makeCallback(done)
service = self
+
class GetCapabilitiesCommand(Command):
+
def __init__(self):
- super(GetCapabilitiesCommand, self).__init__(service.channel, service, "getCapabilities", (context_id,))
+ super(GetCapabilitiesCommand, self).__init__(service.channel,
+ service,
+ "getCapabilities",
+ (context_id,))
+
def done(self, error, args):
arr = None
if not error:
@@ -34,9 +42,16 @@ class DisassemblyProxy(disassembly.DisassemblyService):
def disassemble(self, context_id, addr, size, params, done):
done = self._makeCallback(done)
service = self
+
class DisassembleCommand(Command):
+
def __init__(self):
- super(DisassembleCommand, self).__init__(service.channel, service, "disassemble", (context_id, addr, size, params))
+ super(DisassembleCommand, self).__init__(service.channel,
+ service,
+ "disassemble",
+ (context_id, addr,
+ size, params))
+
def done(self, error, args):
arr = None
if not error:
@@ -48,11 +63,14 @@ class DisassemblyProxy(disassembly.DisassemblyService):
def _toDisassemblyArray(o):
- if o is None: return None
+ if o is None:
+ return None
return map(_toDisassemblyLine, o)
+
def _toDisassemblyLine(m):
addr = m.get("Address")
size = m.get("Size")
instruction = m.get("Instruction")
- return disassembly.DisassemblyLine(addr, size, instruction)
+ opcodeValue = m.get("OpcodeValue")
+ return disassembly.DisassemblyLine(addr, size, instruction, opcodeValue)
diff --git a/python/src/tcf/services/remote/SymbolsProxy.py b/python/src/tcf/services/remote/SymbolsProxy.py
index 132999c..a8556f1 100644
--- a/python/src/tcf/services/remote/SymbolsProxy.py
+++ b/python/src/tcf/services/remote/SymbolsProxy.py
@@ -1,4 +1,4 @@
-# *******************************************************************************
+# *****************************************************************************
# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
@@ -7,7 +7,7 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
from tcf import channel
from tcf.services import symbols
@@ -24,30 +24,42 @@ class Context(symbols.Symbol):
class SymbolsProxy(symbols.SymbolsService):
+
def __init__(self, channel):
self.channel = channel
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
done = self._makeCallback(done)
service = self
+
class GetContextCommand(Command):
def __init__(self):
- super(GetContextCommand, self).__init__(service.channel, service, "getContext", (id,))
+ super(GetContextCommand, self).__init__(service.channel,
+ service, "getContext",
+ (contextID,))
+
def done(self, error, args):
ctx = None
if not error:
assert len(args) == 2
error = self.toError(args[0])
- if args[1]: ctx = Context(args[1])
+ if args[1]:
+ ctx = Context(args[1])
done.doneGetContext(self.token, error, ctx)
return GetContextCommand().token
def getChildren(self, parent_context_id, done):
done = self._makeCallback(done)
service = self
+
class GetChildrenCommand(Command):
+
def __init__(self):
- super(GetChildrenCommand, self).__init__(service.channel, service, "getChildren", (parent_context_id,))
+ super(GetChildrenCommand, self).__init__(service.channel,
+ service,
+ "getChildren",
+ (parent_context_id,))
+
def done(self, error, args):
contexts = None
if not error:
@@ -57,27 +69,90 @@ class SymbolsProxy(symbols.SymbolsService):
done.doneGetChildren(self.token, error, contexts)
return GetChildrenCommand().token
+ def getLocationInfo(self, symbolID, done):
+ """Retrieve symbol location information.
+ @param symbol_id - symbol ID.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ done = self._makeCallback(done)
+ service = self
+
+ class GetLocationInfoCommand(Command):
+ def __init__(self):
+ super(GetLocationInfoCommand, self).__init__(service.channel,
+ service,
+ "getLocationInfo",
+ (symbolID,))
+
+ def done(self, error, args):
+ props = None
+ if not error:
+ assert len(args) == 2
+ error = self.toError(args[0])
+ props = args[1]
+ done.doneGetContext(self.token, error, props)
+ return GetLocationInfoCommand().token
+
+ def getSymFileInfo(self, contextID, address, done):
+ """Get symbol file info for a module that contains given address in a
+ memory space.
+ @param contextID - a memory space (process) ID.
+ @param address - an address in the memory space.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ done = self._makeCallback(done)
+ service = self
+
+ class GetSymFileInfoCommand(Command):
+ def __init__(self):
+ super(GetSymFileInfoCommand, self).__init__(service.channel,
+ service,
+ "getSymFileInfo",
+ (contextID,
+ address,))
+
+ def done(self, error, args):
+ props = None
+ if not error:
+ assert len(args) == 2
+ error = self.toError(args[0])
+ props = args[1]
+ done.doneGetContext(self.token, error, props)
+ return GetSymFileInfoCommand().token
+
def find(self, context_id, ip, name, done):
done = self._makeCallback(done)
service = self
+
class FindCommand(Command):
+
def __init__(self):
- super(FindCommand, self).__init__(service.channel, service, "find", (context_id, ip, name))
+ super(FindCommand, self).__init__(service.channel, service,
+ "find", (context_id, ip,
+ name))
+
def done(self, error, args):
- id = None
+ symbolID = None
if not error:
assert len(args) == 2
error = self.toError(args[0])
- id = args[1]
- done.doneFind(self.token, error, id)
+ symbolID = args[1]
+ done.doneFind(self.token, error, symbolID)
return FindCommand().token
def findByName(self, context_id, ip, name, done):
done = self._makeCallback(done)
service = self
+
class FindByNameCommand(Command):
+
def __init__(self):
- super(FindByNameCommand, self).__init__(service.channel, service, "findByName", (context_id, ip, name))
+ super(FindByNameCommand, self).__init__(service.channel,
+ service, "findByName",
+ (context_id, ip, name))
+
def done(self, error, args):
ids = []
if not error:
@@ -91,9 +166,16 @@ class SymbolsProxy(symbols.SymbolsService):
def findInScope(self, context_id, ip, scope_id, name, done):
done = self._makeCallback(done)
service = self
+
class FindInScopeCommand(Command):
+
def __init__(self):
- super(FindInScopeCommand, self).__init__(service.channel, service, "findInScope", (context_id, ip, scope_id, name))
+ super(FindInScopeCommand, self).__init__(service.channel,
+ service,
+ "findInScope",
+ (context_id, ip,
+ scope_id, name))
+
def done(self, error, args):
ids = []
if not error:
@@ -107,24 +189,33 @@ class SymbolsProxy(symbols.SymbolsService):
def findByAddr(self, context_id, addr, done):
done = self._makeCallback(done)
service = self
+
class FindByAddrCommand(Command):
+
def __init__(self):
- super(FindByAddrCommand, self).__init__(service.channel, service, "findByAddr", (context_id, addr))
+ super(FindByAddrCommand, self).__init__(service.channel,
+ service, "findByAddr",
+ (context_id, addr))
+
def done(self, error, args):
- id = None
+ symbolID = None
if not error:
assert len(args) == 2
error = self.toError(args[0])
- id = args[1]
- done.doneFind(self.token, error, id)
+ symbolID = args[1]
+ done.doneFind(self.token, error, symbolID)
return FindByAddrCommand().token
- def list(self, context_id, done):
+ def list(self, context_id, done): # @ReservedAssignment
done = self._makeCallback(done)
service = self
+
class ListCommand(Command):
+
def __init__(self):
- super(ListCommand, self).__init__(service.channel, service, "list", (context_id,))
+ super(ListCommand, self).__init__(service.channel, service,
+ "list", (context_id,))
+
def done(self, error, args):
lst = None
if not error:
@@ -137,24 +228,37 @@ class SymbolsProxy(symbols.SymbolsService):
def getArrayType(self, type_id, length, done):
done = self._makeCallback(done)
service = self
+
class GetArrayTypeCommand(Command):
+
def __init__(self):
- super(GetArrayTypeCommand, self).__init__(service.channel, service, "getArrayType", (type_id, length))
+ super(GetArrayTypeCommand, self).__init__(service.channel,
+ service,
+ "getArrayType",
+ (type_id, length))
+
def done(self, error, args):
- id = None
+ symbolID = None
if not error:
assert len(args) == 2
error = self.toError(args[0])
- id = args[1]
- done.doneGetArrayType(self.token, error, id)
+ symbolID = args[1]
+ done.doneGetArrayType(self.token, error, symbolID)
return GetArrayTypeCommand().token
def findFrameInfo(self, context_id, address, done):
done = self._makeCallback(done)
service = self
+
class FindFrameInfoCommand(Command):
+
def __init__(self):
- super(FindFrameInfoCommand, self).__init__(service.channel, service, "findFrameInfo", (context_id, address))
+ super(FindFrameInfoCommand, self).__init__(service.channel,
+ service,
+ "findFrameInfo",
+ (context_id,
+ address))
+
def done(self, error, args):
address = None
size = None
@@ -164,5 +268,6 @@ class SymbolsProxy(symbols.SymbolsService):
assert len(args) == 5
error = self.toError(args[0])
address, size, fp_cmds, reg_cmds = args[1:5]
- done.doneFindFrameInfo(self.token, error, address, size, fp_cmds, reg_cmds)
+ done.doneFindFrameInfo(self.token, error, address, size,
+ fp_cmds, reg_cmds)
return FindFrameInfoCommand().token
diff --git a/python/src/tcf/services/runcontrol.py b/python/src/tcf/services/runcontrol.py
index cd8da5f..c2ee7f2 100644
--- a/python/src/tcf/services/runcontrol.py
+++ b/python/src/tcf/services/runcontrol.py
@@ -168,6 +168,9 @@ STATE_SIGNAL_DESCRIPTION = "SignalDescription"
STATE_BREAKPOINT_IDS = "BPs"
STATE_PC_ERROR = "PCError"
+# Boolean - true if the context is running in reverse
+STATE_REVERSING = "Reversing"
+
# Optional parameters of resume command.
# Integer - starting address of step range, inclusive */
RP_RANGE_START = "RangeStart"
diff --git a/python/src/tcf/services/stacktrace.py b/python/src/tcf/services/stacktrace.py
index dfbc4c6..027731f 100644
--- a/python/src/tcf/services/stacktrace.py
+++ b/python/src/tcf/services/stacktrace.py
@@ -1,5 +1,5 @@
#******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -16,17 +16,39 @@ NAME = "StackTrace"
#
# Stack frame context property names.
#
-PROP_ID = "ID" # String, stack frame ID
-PROP_PARENT_ID = "ParentID" # String, stack frame parent ID
-PROP_PROCESS_ID = "ProcessID" # String, stack frame process ID
-PROP_NAME = "Name" # String, human readable name
-PROP_TOP_FRAME = "TopFrame" # Boolean, true if the frame is top frame on a stack
-PROP_LEVEL = "Level" # Integer, stack frame level, starting from stack bottom
-PROP_FRAME_ADDRESS = "FP" # Number, stack frame memory address
-PROP_RETURN_ADDRESS = "RP" # Number, return address
-PROP_INSTRUCTION_ADDRESS = "IP" # Number, instruction pointer
-PROP_ARGUMENTS_COUNT = "ArgsCnt" # Integer, number of function arguments
-PROP_ARGUMENTS_ADDRESS = "ArgsAddr" # Number, memory address of function arguments
+# String, stack frame ID
+PROP_ID = "ID"
+
+# String, stack frame parent ID
+PROP_PARENT_ID = "ParentID"
+
+# String, stack frame process ID
+PROP_PROCESS_ID = "ProcessID"
+
+# String, human readable name
+PROP_NAME = "Name"
+
+# Boolean, true if the frame is top frame on a stack
+PROP_TOP_FRAME = "TopFrame"
+
+# Integer, stack frame level, starting from stack bottom
+PROP_LEVEL = "Level"
+
+# Number, stack frame memory address
+PROP_FRAME_ADDRESS = "FP"
+
+# Number, return address
+PROP_RETURN_ADDRESS = "RP"
+
+# Number, instruction pointer
+PROP_INSTRUCTION_ADDRESS = "IP"
+
+# Integer, number of function arguments
+PROP_ARGUMENTS_COUNT = "ArgsCnt"
+
+# Number, memory address of function arguments
+PROP_ARGUMENTS_ADDRESS = "ArgsAddr"
+
class StackTraceService(services.Service):
def getName(self):
@@ -48,9 +70,9 @@ class StackTraceService(services.Service):
"""
Retrieve stack trace context list.
Parent context usually corresponds to an execution thread.
- Some targets have more then one stack. In such case children of a thread
- are stacks, and stack frames are deeper in the hierarchy - they can be
- retrieved with additional getChildren commands.
+ Some targets have more then one stack. In such case children of a
+ thread are stacks, and stack frames are deeper in the hierarchy - they
+ can be retrieved with additional getChildren commands.
The command will fail if parent thread is not suspended.
Client can use Run Control service to suspend a thread.
@@ -60,6 +82,7 @@ class StackTraceService(services.Service):
"""
raise NotImplementedError("Abstract method")
+
class DoneGetContext(object):
"""
Client call back interface for getContext().
@@ -67,11 +90,13 @@ class DoneGetContext(object):
def doneGetContext(self, token, error, contexts):
"""
Called when context data retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param contexts - array of context data or None if error.
"""
pass
+
class DoneGetChildren(object):
"""
Client call back interface for getChildren().
@@ -79,12 +104,14 @@ class DoneGetChildren(object):
def doneGetChildren(self, token, error, context_ids):
"""
Called when context list retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
Stack frames are ordered from stack bottom to top.
"""
pass
+
class StackTraceContext(object):
"""
StackTraceContext represents stack trace objects - stacks and stack frames.
diff --git a/python/src/tcf/services/streams.py b/python/src/tcf/services/streams.py
index 446941b..6e92054 100644
--- a/python/src/tcf/services/streams.py
+++ b/python/src/tcf/services/streams.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,32 +7,40 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
-Streams service is a generic interface to support streaming of data between host and remote agents.
+Streams service is a generic interface to support streaming of data between
+host and remote agents.
The service supports:
- 1. Asynchronous overlapped data streaming: multiple 'read' or 'write' command can be issued at same time, both peers
- can continue data processing concurrently with data transmission.
+ 1. Asynchronous overlapped data streaming: multiple 'read' or 'write' command
+ can be issued at same time, both peers can continue data processing
+ concurrently with data transmission.
2. Multicast: multiple clients can receive data from same stream.
- 3. Subscription model: clients are required to expressed interest in particular streams by subscribing for the service.
- 4. Flow control: peers can throttle data flow of individual streams by delaying 'read' and 'write' commands.
+ 3. Subscription model: clients are required to expressed interest in
+ particular streams by subscribing for the service.
+ 4. Flow control: peers can throttle data flow of individual streams by
+ delaying 'read' and 'write' commands.
"""
from tcf import services
NAME = "Streams"
+
class StreamsService(services.Service):
def getName(self):
return NAME
def subscribe(self, stream_type, listener, done):
"""
- Clients must subscribe for one or more stream types to be able to send or receive stream data.
- Subscribers receive notifications when a stream of given type is created or disposed.
- Subscribers are required to respond with 'read' or 'disconnect' commands as necessary.
+ Clients must subscribe for one or more stream types to be able to send
+ or receive stream data.
+ Subscribers receive notifications when a stream of given type is
+ created or disposed.
+ Subscribers are required to respond with 'read' or 'disconnect'
+ commands as necessary.
@param stream_type - the stream source type.
@param listener - client implementation of StreamsListener interface.
@param done - command result call back object.
@@ -52,13 +60,18 @@ class StreamsService(services.Service):
def read(self, stream_id, size, done):
"""
- Read data from a stream. If stream buffer is empty, the command will wait until data is available.
- Remote peer will continue to process other commands while 'read' command is pending.
- Client can send more 'read' commands without waiting for the first command to complete.
+ Read data from a stream. If stream buffer is empty, the command will
+ wait until data is available.
+ Remote peer will continue to process other commands while 'read'
+ command is pending.
+ Client can send more 'read' commands without waiting for the first
+ command to complete.
Doing that improves communication channel bandwidth utilization.
Pending 'read' commands will be executed in same order as issued.
- Client can delay sending of 'read' command if it is not ready to receive more data,
- however, delaying for too long can cause stream buffer overflow and lost of data.
+ Client can delay sending of 'read' command if it is not ready to
+ receive more data,
+ however, delaying for too long can cause stream buffer overflow and
+ lost of data.
@param stream_id - ID of the stream.
@param size - max number of bytes to read.
@param done - command result call back object.
@@ -68,9 +81,12 @@ class StreamsService(services.Service):
def write(self, stream_id, buf, offset, size, done):
"""
- Write data to a stream. If stream buffer is full, the command will wait until space is available.
- Remote peer will continue to process other commands while 'write' command is pending.
- Client can send more 'write' commands without waiting for the first command to complete.
+ Write data to a stream. If stream buffer is full, the command will wait
+ until space is available.
+ Remote peer will continue to process other commands while 'write'
+ command is pending.
+ Client can send more 'write' commands without waiting for the first
+ command to complete.
Doing that improves communication channel bandwidth utilization.
Pending 'write' commands will be executed in same order as issued.
@param stream_id - ID of the stream.
@@ -84,7 +100,8 @@ class StreamsService(services.Service):
def eos(self, stream_id, done):
"""
- Send End Of Stream marker to a stream. No more writing to the stream is allowed after that.
+ Send End Of Stream marker to a stream. No more writing to the stream is
+ allowed after that.
@param stream_id - ID of the stream.
@param done - command result call back object.
@return - pending command handle.
@@ -94,9 +111,12 @@ class StreamsService(services.Service):
def connect(self, stream_id, done):
"""
Connect client to a stream.
- Some data might be dropped from the stream by the time "connect" command is executed.
- Client should be able to re-sync with stream data if it wants to read from such stream.
- If a client wants to read a stream from the beginning it should use "subscribe" command
+ Some data might be dropped from the stream by the time "connect"
+ command is executed.
+ Client should be able to re-sync with stream data if it wants to read
+ from such stream.
+ If a client wants to read a stream from the beginning it should use
+ "subscribe" command
instead of "connect".
@param stream_id - ID of the stream.
@param done - command result call back object.
@@ -117,11 +137,15 @@ class StreamsService(services.Service):
class StreamsListener(object):
"""
Clients can implement StreamsListener interface to be notified
- when a stream is created or disposed. The interface is registered with 'subscribe' command.
+ when a stream is created or disposed. The interface is registered with
+ 'subscribe' command.
- When new stream is created, client must decide if it is interested in that particular stream instance.
- If not interested, client should send 'disconnect' command to allow remote peer to free resources and bandwidth.
- If not disconnected, client is required to send 'read' commands as necessary to prevent stream buffer overflow.
+ When new stream is created, client must decide if it is interested in that
+ particular stream instance.
+ If not interested, client should send 'disconnect' command to allow remote
+ peer to free resources and bandwidth.
+ If not disconnected, client is required to send 'read' commands as
+ necessary to prevent stream buffer overflow.
"""
def created(self, stream_type, stream_id, context_id):
@@ -129,9 +153,11 @@ class StreamsListener(object):
Called when a new stream is created.
@param stream_type - source type of the stream.
@param stream_id - ID of the stream.
- @param context_id - a context ID that is associated with the stream, or None.
+ @param context_id - a context ID that is associated with the stream,
+ or None.
Exact meaning of the context ID depends on stream type.
- Stream types and context IDs are defined by services that use Streams service to transmit data.
+ Stream types and context IDs are defined by services that use Streams
+ service to transmit data.
"""
pass
@@ -143,6 +169,7 @@ class StreamsListener(object):
"""
pass
+
class DoneSubscribe(object):
"""
Call back interface for 'subscribe' command.
@@ -150,6 +177,7 @@ class DoneSubscribe(object):
def doneSubscribe(self, token, error):
pass
+
class DoneUnsubscribe(object):
"""
Call back interface for 'unsubscribe' command.
@@ -157,6 +185,7 @@ class DoneUnsubscribe(object):
def doneUnsubscribe(self, token, error):
pass
+
class DoneRead(object):
"""
Call back interface for 'read' command.
@@ -166,15 +195,17 @@ class DoneRead(object):
Called when 'read' command is done.
@param token - command handle.
@param error - error object or None.
- @param lost_size - number of bytes that were lost because of buffer overflow.
- 'lost_size' -1 means unknown number of bytes were lost.
- if both 'lost_size' and 'data.length' are non-zero then lost bytes are considered
- located right before read bytes.
+ @param lost_size - number of bytes that were lost because of buffer
+ overflow. 'lost_size' -1 means unknown number of
+ bytes were lost. If both 'lost_size' and
+ 'data.length' are non-zero then lost bytes are
+ considered located right before read bytes.
@param data - bytes read from the stream.
@param eos - true if end of stream was reached.
"""
pass
+
class DoneWrite(object):
"""
Call back interface for 'write' command.
@@ -187,6 +218,7 @@ class DoneWrite(object):
"""
pass
+
class DoneEOS(object):
"""
Call back interface for 'eos' command.
@@ -199,6 +231,7 @@ class DoneEOS(object):
"""
pass
+
class DoneConnect(object):
"""
Call back interface for 'connect' command.
@@ -211,6 +244,7 @@ class DoneConnect(object):
"""
pass
+
class DoneDisconnect(object):
"""
Call back interface for 'disconnect' command.
diff --git a/python/src/tcf/services/symbols.py b/python/src/tcf/services/symbols.py
index d0008eb..38bc956 100644
--- a/python/src/tcf/services/symbols.py
+++ b/python/src/tcf/services/symbols.py
@@ -14,16 +14,18 @@ from tcf import services
# Service name.
NAME = "Symbols"
+
class SymbolClass:
unknown = 0 # unknown symbol class
value = 1 # constant value
reference = 2 # variable data object
function = 3 # function body
- type = 4 # a type
+ type = 4 # a type @ReservedAssignment
comp_unit = 5 # a compilation unit
block = 6 # a block of code
namespace = 7 # a namespace
+
class TypeClass:
unknown = 0 # unknown type class
cardinal = 1 # unsigned integer
@@ -83,6 +85,7 @@ PROP_VALUE = "Value"
PROP_BIG_ENDIAN = "BigEndian"
PROP_REGISTER = "Register"
PROP_FLAGS = "Flags"
+PROP_CONTAINER_ID = "ContainerID"
#
# Symbol context properties update policies.
@@ -90,13 +93,15 @@ PROP_FLAGS = "Flags"
# Update policy "Memory Map": symbol properties become invalid when
# memory map changes - when modules are loaded or unloaded.
-# Symbol OwnerID indicates memory space (process) that is invalidation events source.
+# Symbol OwnerID indicates memory space (process) that is invalidation events
+# source.
# Most static variables and types have this update policy.
UPDATE_ON_MEMORY_MAP_CHANGES = 0
# Update policy "Execution State": symbol properties become invalid when
# execution state changes - a thread is suspended, resumed or exited.
-# Symbol OwnerID indicates executable context (thread) that is invalidation events source.
+# Symbol OwnerID indicates executable context (thread) that is invalidation
+# events source.
# Most stack (auto) variables have this update policy.
UPDATE_ON_EXE_STATE_CHANGES = 1
@@ -179,6 +184,16 @@ class Symbol(object):
"""
return self._props.get(PROP_BASE_TYPE_ID)
+ def getContainerID(self):
+ """Get container type ID.
+ If this symbol is a
+ field or member - return containing class type;
+ member pointer - return containing class type;
+ otherwise return None.
+ @return type ID.
+ """
+ return self._props.get(PROP_CONTAINER_ID)
+
def getIndexTypeID(self):
"""
Get index type ID.
@@ -266,16 +281,17 @@ class Symbol(object):
"""
return self._props
+
class SymbolsService(services.Service):
def getName(self):
return NAME
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
"""
Retrieve symbol context info for given symbol ID.
@see Symbol
- @param id - symbol context ID.
+ @param contextID - symbol context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
@@ -300,7 +316,8 @@ class SymbolsService(services.Service):
The context can be memory space, process, thread or stack frame.
@param context_id - a search scope.
- @param ip - instruction pointer - ignored if context_id is a stack frame ID
+ @param ip - instruction pointer - ignored if context_id is a stack
+ frame ID
@param name - symbol name.
@param done - call back interface called when operation is completed.
@return - pending command handle.
@@ -313,7 +330,8 @@ class SymbolsService(services.Service):
The context can be memory space, process, thread or stack frame.
@param context_id - a search scope.
- @param ip - instruction pointer - ignored if context_id is a stack frame ID
+ @param ip - instruction pointer - ignored if context_id is a stack
+ frame ID
@param name - symbol name.
@param done - call back interface called when operation is completed.
@return - pending command handle.
@@ -334,7 +352,8 @@ class SymbolsService(services.Service):
def findInScope(self, context_id, ip, scope_id, name, done):
"""
- Search symbols with given name in given context or in given symbol scope.
+ Search symbols with given name in given context or in given symbol
+ scope.
The context can be memory space, process, thread or stack frame.
The symbol scope can be any symbol.
If ip is not null, the search of the symbol name is done first in the
@@ -351,7 +370,7 @@ class SymbolsService(services.Service):
"""
raise NotImplementedError("Abstract method")
- def list(self, context_id, done):
+ def list(self, context_id, done): # @ReservedAssignment
"""
List all symbols in given context.
The context can be a stack frame.
@@ -376,7 +395,8 @@ class SymbolsService(services.Service):
def findFrameInfo(self, context_id, address, done):
"""
- Retrieve stack tracing commands for given instruction address in a context memory.
+ Retrieve stack tracing commands for given instruction address in a
+ context memory.
@param context_id - exacutable context ID.
@param address - instruction address.
@param done - call back interface called when operation is completed.
@@ -384,6 +404,25 @@ class SymbolsService(services.Service):
"""
raise NotImplementedError("Abstract method")
+ def getLocationInfo(self, symbolID, done):
+ """Retrieve symbol location information.
+ @param symbol_id - symbol ID.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ raise NotImplementedError("Abstract method")
+
+ def getSymFileInfo(self, contextID, address, done):
+ """Get symbol file info for a module that contains given address in a
+ memory space.
+ @param contextID - a memory space (process) ID.
+ @param address - an address in the memory space.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ raise NotImplementedError("Abstract method")
+
+
class DoneGetContext(object):
"""
Client call back interface for getContext().
@@ -392,11 +431,25 @@ class DoneGetContext(object):
"""
Called when context data retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context properties.
"""
pass
+
+class DoneGetLocationInfo(object):
+ """Client call back interface for getLocationInfo()."""
+ def doneGetLocationInfo(self, token, error, props):
+ """Called when location information retrieval is done.
+ @param token - command handle.
+ @param error - error description if operation failed, None if
+ succeeded.
+ @param props - symbol location properties, see LOC_ * .
+ """
+ pass
+
+
class DoneGetChildren(object):
"""
Client call back interface for getChildren().
@@ -405,11 +458,13 @@ class DoneGetChildren(object):
"""
Called when context list retrieval is done.
@param token - command handle
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
"""
pass
+
class DoneFind(object):
"""
Client call back interface for find(), findByName() and findInScope().
@@ -418,11 +473,25 @@ class DoneFind(object):
"""
Called when symbol search is done.
@param token - command handle.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param symbol_ids - list of symbol ID.
"""
pass
+
+class DoneGetSymFileInfo(object):
+ """Client call back interface for getSymFileInfo()."""
+ def doneGetSymFileInfo(self, token, error, props):
+ """Called when symbol file information retrieval is done.
+ @param token - command handle.
+ @param error - error description if operation failed, None if
+ succeeded.
+ @param props - symbol file properties.
+ """
+ pass
+
+
class DoneList(object):
"""
Client call back interface for list().
@@ -431,10 +500,12 @@ class DoneList(object):
"""
Called when symbol list retrieval is done.
@param token - command handle.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param symbol_ids - array of symbol IDs.
"""
+
class DoneGetArrayType(object):
"""
Client call back interface for getArrayType().
@@ -443,43 +514,100 @@ class DoneGetArrayType(object):
"""
Called when array type creation is done.
@param token - command handle.
- @param error - error description if operation failed, None if succeeded.
- @param type_id - array type symbol ID
+ @param error - error description if operation failed, None if
+ succeeded.
+ @param type_id - array type symbol ID
"""
#
-# Command codes that are used to calculate frame pointer and register values during stack tracing.
+# Command codes that are used to calculate frame pointer and register values
+# during stack tracing.
#
# Load a number to the evaluation stack. Command argument is the number.
-CMD_NUMBER = 1
-
-# Load a register value to the evaluation stack. Command argument is the register ID.
-CMD_REGISTER = 2
+CMD_NUMBER = 1
# Load frame address to the evaluation stack.
-CMD_FP = 3
-
-# Read memory at address on the top of the evaluation stack. Command arguments are
-# the value size (Number) and endianness (Boolean, false - little-endian, true - big-endian).
-CMD_DEREF = 4
+CMD_FP = 3
# Add two values on top of the evaluation stack
-CMD_ADD = 5
+CMD_ADD = 5
+
+CMD_SUB = 6
+CMD_MUL = 7
+CMD_DIV = 8
+CMD_AND = 9
+CMD_OR = 10
+CMD_XOR = 11
+CMD_NEG = 12
+CMD_GE = 13
+CMD_GT = 14
+CMD_LE = 15
+CMD_LT = 16
+CMD_SHL = 17
+CMD_SHR = 18
+
+# Load expression argument to evaluation stack.
+CMD_ARG = 19
+
+# Evaluate DWARF location expression. Command arguments are byte array of
+# DWARF expression instructions and an object that contains evaluation
+# parameters.
+CMD_LOCATION = 20
+
+CMD_FCALL = 21
+CMD_WR_REG = 22
+CMD_WR_MEM = 23
+CMD_PIECE = 24
+
+# deprecated
+# Load a register value to the evaluation stack. Command argument is the
+# register ID.
+CMD_REGISTER = 2
+
+# Read memory at address on the top of the evaluation stack. Command arguments
+# are the value size (Number) and endianness (Boolean, false - little-endian,
+# true - big-endian).
+CMD_DEREF = 4
+
+# Symbol location properties.
+
+# Number, start address of code range where the location info is valid, or null
+# if it is valid everywhere
+LOC_CODE_ADDR = "CodeAddr"
+
+# Number, size in bytes of code range where the location info is valid, or null
+# if it is valid everywhere
+LOC_CODE_SIZE = "CodeSize"
+
+
+# Number, number of argument required to execute location instructions
+LOC_ARG_CNT = "ArgCnt"
+
+# List, instructions to compute object value location, e.g. address, or offset,
+# or register ID, etc.
+LOC_VALUE_CMDS = "ValueCmds"
+
+# List, instructions to compute dynamic array length location
+LOC_LENGTH_CMDS = "LengthCmds"
+
class DoneFindFrameInfo(object):
"""
Client call back interface for findFrameInfo().
"""
- def doneFindFrameInfo(self, token, error, address, size, fp_cmds, reg_cmds):
+ def doneFindFrameInfo(self, token, error, address, size, fp_cmds,
+ reg_cmds):
"""
Called when stack tracing information retrieval is done.
@param token - command handle.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param address - start of instruction address range
@param size - size of instruction address range
@param fp_cmds - commands to calculate stack frame pointer
- @param reg_cmds - map register IDs -> commands to calculate register values
+ @param reg_cmds - map register IDs -> commands to calculate register
+ values
"""
pass
diff --git a/python/src/tcf/services/sysmonitor.py b/python/src/tcf/services/sysmonitor.py
index e758e4e..078a6a4 100644
--- a/python/src/tcf/services/sysmonitor.py
+++ b/python/src/tcf/services/sysmonitor.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,13 +7,16 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
This is an optional service that can be implemented by a peer.
-If implemented, the service can be used for monitoring system activity and utilization.
-It provides list of running processes, different process attributes like command line, environment, etc.,
-and some resource utilization data. The service can be used by a client to provide functionality
+If implemented, the service can be used for monitoring system activity and
+utilization.
+It provides list of running processes, different process attributes like
+command line, environment, etc.,
+and some resource utilization data. The service can be used by a client to
+provide functionality
similar to Unix 'top' utility or Windows 'Task Manager'.
"""
@@ -84,7 +87,8 @@ PROP_FLAGS = "Flags"
# required loading a memory page from disk
PROP_MINFLT = "MinFlt"
-# The number of minor faults that the process's waited-for children have made
+# The number of minor faults that the process's waited-for children have
+# made
PROP_CMINFLT = "CMinFlt"
# The number of major faults the process has made which have required
@@ -98,7 +102,8 @@ PROP_CMAJFLT = "CMajFlt"
# The number of milliseconds that this process has been scheduled in user mode
PROP_UTIME = "UTime"
-# The number of milliseconds that this process has been scheduled in kernel mode
+# The number of milliseconds that this process has been scheduled in kernel
+# mode
PROP_STIME = "STime"
# The number of jiffies that this process's waited-for children have
@@ -186,11 +191,12 @@ class SysMonitorContext(object):
"""
A context corresponds to an execution thread, process, address space, etc.
A context can belong to a parent context. Contexts hierarchy can be simple
- plain list or it can form a tree. It is up to target agent developers to choose
- layout that is most descriptive for a given target. Context IDs are valid across
- all services. In other words, all services access same hierarchy of contexts,
- with same IDs, however, each service accesses its own subset of context's
- attributes and functionality, which is relevant to that service.
+ plain list or it can form a tree. It is up to target agent developers to
+ choose layout that is most descriptive for a given target. Context IDs are
+ valid across all services. In other words, all services access same
+ hierarchy of contexts, with same IDs, however, each service accesses its
+ own subset of context's attributes and functionality, which is relevant to
+ that service.
"""
def __init__(self, props):
self._props = props or {}
@@ -336,11 +342,11 @@ class SysMonitorService(services.Service):
def getName(self):
return NAME
- def getContext(self, id, done):
+ def getContext(self, contextID, done):
"""
Retrieve context info for given context ID.
- @param id - context ID.
+ @param contextID - context ID.
@param done - callback interface called when operation is completed.
"""
raise NotImplementedError("Abstract method")
@@ -356,13 +362,13 @@ class SysMonitorService(services.Service):
"""
raise NotImplementedError("Abstract method")
- def getCommandLine(self, id, done):
+ def getCommandLine(self, contextID, done):
"""
Get context command line.
"""
raise NotImplementedError("Abstract method")
- def getEnvironment(self, id, done):
+ def getEnvironment(self, contextID, done):
"""
Get context environment variables.
"""
@@ -376,11 +382,13 @@ class DoneGetContext(object):
def doneGetContext(self, token, error, context):
"""
Called when context data retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context - context data.
"""
pass
+
class DoneGetChildren(object):
"""
Client callback interface for getChildren().
@@ -388,15 +396,18 @@ class DoneGetChildren(object):
def doneGetChildren(self, token, error, context_ids):
"""
Called when context list retrieval is done.
- @param error - error description if operation failed, None if succeeded.
+ @param error - error description if operation failed, None if
+ succeeded.
@param context_ids - array of available context IDs.
"""
pass
+
class DoneGetCommandLine(object):
def doneGetCommandLine(self, token, error, cmd_line):
pass
+
class DoneGetEnvironment(object):
def doneGetEnvironment(self, token, error, environment):
pass