Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'python/src/tcf/services')
-rw-r--r--python/src/tcf/services/__init__.py12
-rw-r--r--python/src/tcf/services/breakpoints.py29
-rw-r--r--python/src/tcf/services/expressions.py25
-rw-r--r--python/src/tcf/services/filesystem.py97
-rw-r--r--python/src/tcf/services/linenumbers.py5
-rw-r--r--python/src/tcf/services/local/LocatorService.py26
-rw-r--r--python/src/tcf/services/locator.py17
-rw-r--r--python/src/tcf/services/memory.py303
-rw-r--r--python/src/tcf/services/memorymap.py188
-rw-r--r--python/src/tcf/services/processes.py33
-rw-r--r--python/src/tcf/services/registers.py29
-rw-r--r--python/src/tcf/services/remote/BreakpointsProxy.py3
-rw-r--r--python/src/tcf/services/remote/ExpressionsProxy.py3
-rw-r--r--python/src/tcf/services/remote/FileSystemProxy.py4
-rw-r--r--python/src/tcf/services/remote/LineNumbersProxy.py4
-rw-r--r--python/src/tcf/services/remote/LocatorProxy.py19
-rw-r--r--python/src/tcf/services/remote/MemoryMapProxy.py84
-rw-r--r--python/src/tcf/services/remote/MemoryProxy.py249
-rw-r--r--python/src/tcf/services/remote/ProcessesProxy.py5
-rw-r--r--python/src/tcf/services/remote/RegistersProxy.py5
-rw-r--r--python/src/tcf/services/remote/RunControlProxy.py13
-rw-r--r--python/src/tcf/services/runcontrol.py31
-rw-r--r--python/src/tcf/services/stacktrace.py23
-rw-r--r--python/src/tcf/services/symbols.py31
24 files changed, 1026 insertions, 212 deletions
diff --git a/python/src/tcf/services/__init__.py b/python/src/tcf/services/__init__.py
index 9febd3f00..dc7a1c050 100644
--- a/python/src/tcf/services/__init__.py
+++ b/python/src/tcf/services/__init__.py
@@ -9,7 +9,7 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import threading, exceptions, collections
+import threading, collections
from tcf import protocol
_providers = []
@@ -45,7 +45,7 @@ def onChannelCreated(channel, services_by_name):
for service in arr:
if services_by_name.has_key(service.getName()): continue
services_by_name[service.getName()] = service
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Error calling TCF service provider", x);
def onChannelOpened(channel, service_names, services_by_name):
@@ -57,7 +57,7 @@ def onChannelOpened(channel, service_names, services_by_name):
if not service: continue
services_by_name[name] = service
break
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Error calling TCF service provider", x)
if services_by_name.has_key(name): continue
services_by_name[name] = GenericProxy(channel, name)
@@ -76,7 +76,7 @@ class GenericCallback(object):
class Service(object):
def getName(self):
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def __str__(self):
return self.getName()
def _makeCallback(self, done):
@@ -118,9 +118,9 @@ class DefaultServiceProvider(ServiceProvider):
cls = clsModule.__dict__.get(clsName)
service = cls(channel)
assert service_name == service.getName()
- except exceptions.ImportError:
+ except ImportError:
pass
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Cannot instantiate service proxy for "+service_name, x)
return service
diff --git a/python/src/tcf/services/breakpoints.py b/python/src/tcf/services/breakpoints.py
index 05481d0b4..0ca646119 100644
--- a/python/src/tcf/services/breakpoints.py
+++ b/python/src/tcf/services/breakpoints.py
@@ -23,7 +23,6 @@ persistent and represent user input, breakpoint status reflects dynamic target a
about breakpoint current state, like actual addresses where breakpoint is planted or planting errors.
"""
-import exceptions
from tcf import services
# Service name.
@@ -98,7 +97,7 @@ CAPABILITY_ACCESSMODE = "AccessMode" # Number
class BreakpointsService(services.Service):
def getName(self):
return NAME
-
+
def set(self, properties, done):
"""
Download breakpoints data to target agent.
@@ -106,13 +105,13 @@ class BreakpointsService(services.Service):
when communication channel is open. After that, host should
notify target about (incremental) changes in breakpoint data by sending
add, change and remove commands.
-
+
@param properties - array of breakpoints.
@param done - command result call back object.
@return - pending command handle.
@see DoneCommand
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def add(self, properties, done):
"""
@@ -122,7 +121,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneCommand
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def change(self, properties, done):
"""
@@ -132,7 +131,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneCommand
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def enable(self, ids, done):
"""
@@ -142,7 +141,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneCommand
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def disable(self, ids, done):
"""
@@ -152,7 +151,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneCommand
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def remove(self, ids, done):
"""
@@ -162,7 +161,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneCommand
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getIDs(self, done):
"""
@@ -171,7 +170,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneGetIDs
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getProperties(self, id, done):
"""
@@ -180,7 +179,7 @@ class BreakpointsService(services.Service):
@param done - command result call back object.
@see DoneGetProperties
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getStatus(self, id, done):
"""
@@ -190,7 +189,7 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneGetStatus
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getCapabilities(self, id, done):
"""
@@ -205,21 +204,21 @@ class BreakpointsService(services.Service):
@return - pending command handle.
@see DoneGetCapabilities
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def addListener(self, listener):
"""
Add breakpoints service event listener.
@param listener - object that implements BreakpointsListener interface.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def removeListener(self, listener):
"""
Remove breakpoints service event listener.
@param listener - object that implements BreakpointsListener interface.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneCommand(object):
diff --git a/python/src/tcf/services/expressions.py b/python/src/tcf/services/expressions.py
index 46de26002..8da3b61e6 100644
--- a/python/src/tcf/services/expressions.py
+++ b/python/src/tcf/services/expressions.py
@@ -14,7 +14,6 @@ Expressions service allows TCF client to perform expression evaluation on remote
The service can be used to retrieve or modify values of variables or any data structures in remote target memory.
"""
-import exceptions
from tcf import services
# Service name.
@@ -176,17 +175,17 @@ VAL_BIG_ENDIAN = "BigEndian"
class ExpressionsService(services.Service):
def getName(self):
return NAME
-
+
def getContext(self, id, done):
"""
Retrieve expression context info for given context ID.
@see Expression
-
+
@param id - context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getChildren(self, parent_context_id, done):
"""
@@ -198,15 +197,15 @@ class ExpressionsService(services.Service):
4. stack frame - function arguments and local variables
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.
-
+
@param parent_context_id - parent context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def create(self, parent_id, language, expression, done):
"""
@@ -218,7 +217,7 @@ class ExpressionsService(services.Service):
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def dispose(self, id, done):
"""
@@ -227,7 +226,7 @@ class ExpressionsService(services.Service):
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def evaluate(self, id, done):
"""
@@ -236,7 +235,7 @@ class ExpressionsService(services.Service):
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def assign(self, id, value, done):
"""
@@ -246,21 +245,21 @@ class ExpressionsService(services.Service):
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def addListener(self, listener):
"""
Add expressions service event listener.
@param listener - event listener implementation.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def removeListener(self, listener):
"""
Remove expressions service event listener.
@param listener - event listener implementation.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneGetContext(object):
"""
diff --git a/python/src/tcf/services/filesystem.py b/python/src/tcf/services/filesystem.py
index d4b3f6502..3bba2c0fd 100644
--- a/python/src/tcf/services/filesystem.py
+++ b/python/src/tcf/services/filesystem.py
@@ -69,7 +69,6 @@ splice path name components returned by readdir() together
using a slash ('/') as the separator, and that will work as expected.
"""
-import exceptions
from tcf import services
# Service name.
@@ -146,7 +145,7 @@ class FileAttrs(object):
def isFile(self):
"""
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.
"""
@@ -156,7 +155,7 @@ class FileAttrs(object):
def isDirectory(self):
"""
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.
"""
@@ -190,7 +189,7 @@ S_IXOTH = 00001 # others have execute permission
class DirEntry(object):
"""
- Directory entry.
+ Directory entry.
Fields:
'filename' is a file name being returned. It is a relative name within
the directory, without any path components
@@ -235,14 +234,14 @@ STATUS_NO_SUCH_FILE = 0x10002
# permissions to perform the operation.
STATUS_PERMISSION_DENIED = 0x10003
-class FileSystemException(exceptions.IOError):
+class FileSystemException(IOError):
"""
The class to represent File System error reports.
"""
def __init__(self, message_or_exception):
if isinstance(message_or_exception, str):
super(FileSystemException, self).__init__(message_or_exception)
- elif isinstance(message_or_exception, exceptions.Exception):
+ elif isinstance(message_or_exception, Exception):
self.caused_by = message_or_exception
def getStatus(self):
"""
@@ -250,16 +249,16 @@ class FileSystemException(exceptions.IOError):
one of service specific codes, see STATUS_*.
@return error code.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
class FileSystemService(services.Service):
def getName(self):
return NAME
-
+
def open(self, file_name, flags, attrs, done):
"""
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.
@@ -267,18 +266,18 @@ class FileSystemService(services.Service):
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def close(self, handle, done):
"""
Close a file on a remote system.
-
+
@param handle is a handle previously returned in the response to
open() or opendir().
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def read(self, handle, offset, len, done):
"""
@@ -291,7 +290,7 @@ class FileSystemService(services.Service):
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.
@@ -300,7 +299,7 @@ class FileSystemService(services.Service):
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def write(self, handle, offset, data, data_pos, data_size, done):
"""
@@ -309,7 +308,7 @@ class FileSystemService(services.Service):
It is legal to write way beyond the end of the file the semantics
are to write zeroes from the end of the file to the specified offset
and then the data.
-
+
@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 writing.
@@ -320,40 +319,40 @@ class FileSystemService(services.Service):
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def stat(self, path, done):
"""
Retrieve file attributes.
-
+
@param path - specifies the file system object for which
status is to be returned.
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def lstat(self, path, done):
"""
Retrieve file attributes.
Unlike 'stat()', 'lstat()' does not follow symbolic links.
-
+
@param path - specifies the file system object for which
status is to be returned.
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def fstat(self, handle, done):
"""
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.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def setstat(self, path, attrs, done):
"""
@@ -363,27 +362,27 @@ class FileSystemService(services.Service):
An error will be returned if the specified file system object does
not exist or the user does not have sufficient rights to modify the
specified attributes.
-
+
@param path specifies the file system object (e.g. file or directory)
whose attributes are to be modified.
@param attrs specifies the modifications to be made to file attributes.
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def fsetstat(self, handle, attrs, done):
"""
Set file attributes for an open file (identified by the file handle).
This request is used for operations such as changing the ownership,
permissions or access times, as well as for truncating a file.
-
+
@param handle is a file handle returned by 'open()'.
@param attrs specifies the modifications to be made to file attributes.
@param done is call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def opendir(self, path, done):
"""
@@ -393,12 +392,12 @@ class FileSystemService(services.Service):
When the client no longer wishes to read more names from the
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 done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def readdir(self, handle, done):
"""
@@ -415,18 +414,18 @@ class FileSystemService(services.Service):
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def mkdir(self, path, attrs, done):
"""
Create a directory on the server.
-
+
@param path - specifies the directory to be created.
@param attrs - new directory attributes.
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def rmdir(self, path, done):
"""
@@ -435,12 +434,12 @@ class FileSystemService(services.Service):
with the specified path exists, or if the specified directory is not
empty, or if the path specified a file system object other than a
directory.
-
+
@param path - specifies the directory to be removed.
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def roots(self, done):
"""
@@ -451,34 +450,34 @@ class FileSystemService(services.Service):
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.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def remove(self, file_name, done):
"""
Remove a file or symbolic link.
This request cannot be used to remove directories.
-
+
@param file_name is the name of the file to be removed.
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def realpath(self, path, done):
"""
Canonicalize any given path name to an absolute path.
This is useful for converting path names containing ".." components or
relative pathnames without a leading slash into absolute paths.
-
+
@param path specifies the path name to be canonicalized.
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def rename(self, old_path, new_path, done):
"""
@@ -487,39 +486,39 @@ class FileSystemService(services.Service):
with the name specified by 'new_path'. The server may also fail rename
requests in other situations, for example if 'old_path' and 'new_path'
point to different file systems on the server.
-
+
@param old_path is the name of an existing file or directory.
@param new_path is the new name for the file or directory.
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def readlink(self, path, done):
"""
Read the target of a symbolic link.
-
+
@param path specifies the path name of the symbolic link to be read.
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def symlink(self, link_path, target_path, done):
"""
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 done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def copy(self, src_path, dst_path, copy_permissions, copy_ownership, done):
"""
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 copy_permissions - if True then copy source file permissions.
@@ -527,17 +526,17 @@ class FileSystemService(services.Service):
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
def user(self, done):
"""
Retrieve information about user account, which is used by server
to access file system on behalf of the client.
-
+
@param done - result call back object.
@return pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract methods")
+ raise NotImplementedError("Abstract methods")
class DoneOpen(object):
def doneOpen(self, token, error, handle):
diff --git a/python/src/tcf/services/linenumbers.py b/python/src/tcf/services/linenumbers.py
index 65d1b84ab..410e8d2b4 100644
--- a/python/src/tcf/services/linenumbers.py
+++ b/python/src/tcf/services/linenumbers.py
@@ -14,7 +14,6 @@ Line numbers service associates locations in the source files with the correspon
machine instruction addresses in the executable object.
"""
-import exceptions
from tcf import services
NAME = "LineNumbers"
@@ -119,10 +118,10 @@ class LineNumbersService(services.Service):
return NAME
def mapToSource(self, context_id, start_address, end_address, done):
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def mapToMemory(self, context_id, file, line, column, done):
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneMapToSource(object):
def doneMapToSource(self, token, error, areas):
diff --git a/python/src/tcf/services/local/LocatorService.py b/python/src/tcf/services/local/LocatorService.py
index aa5550e1e..e11f37868 100644
--- a/python/src/tcf/services/local/LocatorService.py
+++ b/python/src/tcf/services/local/LocatorService.py
@@ -123,13 +123,13 @@ class LocatorService(locator.LocatorService):
listeners = [] # list of LocatorListener
error_log = set() # set of str
_error_log_lock = threading.RLock()
-
+
addr_cache = {} # str->AddressCacheItem
_addr_cache_lock = threading.Condition()
addr_request = False
local_peer = None
last_master_packet_time = 0
-
+
def __init__(self):
self.subnets = set()
self.slaves = []
@@ -184,7 +184,7 @@ class LocatorService(locator.LocatorService):
a.address = InetAddress(a.host, addr)
a.time_stamp = time
a.used = False
- except BaseException as x:
+ except Exception as x:
service._log("Unhandled exception in TCF discovery DNS lookup thread", x)
self.dns_lookup_thread = DNSLookupThread()
class InputThread(threading.Thread):
@@ -204,12 +204,12 @@ class LocatorService(locator.LocatorService):
return
except socket.error as x:
if sock != service.socket: continue
- # frequent error on windows, unknown reason
+ # frequent error on windows, unknown reason
if x.errno == 10054: continue
port = sock.getsockname()[1]
service._log("Cannot read from datagram socket at port %d" % port, x)
time.sleep(2)
- except BaseException as x:
+ except Exception as x:
service._log("Unhandled exception in socket reading thread", x)
self.input_thread = InputThread(self.__handleDatagramPacket)
try:
@@ -284,7 +284,7 @@ class LocatorService(locator.LocatorService):
channel.sendResult(token, toJSONSequence((None, arr)))
else:
channel.rejectCommand(token)
- except BaseException as x:
+ except Exception as x:
channel.terminate(x)
def _log(self, msg, x):
@@ -375,7 +375,7 @@ class LocatorService(locator.LocatorService):
subNetSet = set()
try:
self.__getSubNetList(subNetSet)
- except BaseException as x:
+ except Exception as x:
self._log("Cannot get list of network interfaces", x)
for s in tuple(self.subnets):
if s in subNetSet: continue
@@ -428,7 +428,7 @@ class LocatorService(locator.LocatorService):
if self.out_buf[4] == locator.CONF_PEER_INFO:
map = self.__parsePeerAttributes(self.out_buf, 8)
self.__traceDiscoveryPacket(False, self.packetTypes[self.out_buf[4]], map, addr, port)
- except BaseException as x:
+ except Exception as x:
self._log("Cannot send datagram packet to %s" % addr, x)
return False
return True
@@ -436,7 +436,7 @@ class LocatorService(locator.LocatorService):
def __parsePeerAttributes(self, data, size):
"""
Parse peer attributes in CONF_INFO_PEER packet data
-
+
@param data
the packet section that contain the peer attributes
@param size
@@ -592,7 +592,7 @@ class LocatorService(locator.LocatorService):
subnet.last_slaves_req_time = tm
if subnet.address == remote_address and remote_port == DISCOVEY_PORT:
self.last_master_packet_time = tm
- except BaseException as x:
+ except Exception as x:
self._log("Invalid datagram packet received from %s/%s" % (p.getAddress(), p.getPort()), x)
def __handlePeerInfoPacket(self, p):
@@ -617,7 +617,7 @@ class LocatorService(locator.LocatorService):
_peer.updateAttributes(map)
elif _peer is None:
peer.RemotePeer(map)
- except BaseException as x:
+ except Exception as x:
self._log("Invalid datagram packet received from %s/%s" % (p.getAddress(), p.getPort()), x)
def __handleReqInfoPacket(self, p, sl, tm):
@@ -679,7 +679,7 @@ class LocatorService(locator.LocatorService):
self.__addSlave(addr, port, time_val, time_now)
if __TRACE_DISCOVERY__:
self.__traceDiscoveryPacket(True, "CONF_SLAVES_INFO", trace_map, p)
- except BaseException as x:
+ except Exception as x:
self._log("Invalid datagram packet received from %s/%s" % (p.getAddress(), p.getPort()), x)
def __handleReqSlavesPacket(self, p, sl, tm):
@@ -717,7 +717,7 @@ class LocatorService(locator.LocatorService):
Log that a TCF Discovery packet has be sent or received. The trace is
sent to stdout. This should be called only if the tracing has been turned
on.
-
+
@param received
True if the packet was sent, otherwise it was received
@param type
diff --git a/python/src/tcf/services/locator.py b/python/src/tcf/services/locator.py
index 3804bb8de..8ffe42be2 100644
--- a/python/src/tcf/services/locator.py
+++ b/python/src/tcf/services/locator.py
@@ -20,7 +20,6 @@ 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).
"""
-import exceptions
from tcf import services
# Peer data retention period in milliseconds.
@@ -46,34 +45,34 @@ class LocatorService(services.Service):
The method return cached (currently known to the framework) list of peers.
The list is updated according to event received from transport layer
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def redirect(self, peer, done):
"""
Redirect this service channel to given peer using this service as a proxy.
@param peer - Peer ID or attributes map.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ 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.
-
+
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.
-
+
This is internal API, TCF clients should use module 'tcf.protocol'.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def addListener(self, listener):
"Add a listener for Locator service events."
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def removeListener(self, listener):
"Remove a listener for Locator service events."
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneRedirect(object):
def doneRedirect(self, token, error):
diff --git a/python/src/tcf/services/memory.py b/python/src/tcf/services/memory.py
new file mode 100644
index 000000000..de97b2026
--- /dev/null
+++ b/python/src/tcf/services/memory.py
@@ -0,0 +1,303 @@
+# *******************************************************************************
+# * Copyright (c) 2011 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
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * Wind River Systems - initial API and implementation
+# *******************************************************************************
+
+"""
+Memory service provides basic operations to read/write memory on a target.
+"""
+
+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
+
+# 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.
+# 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.
+# 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
+
+
+# Memory access mode:
+# Carry on when some of the memory cannot be accessed and
+# return MemoryError at the end if any of the bytes
+# were not processed correctly.
+MODE_CONTINUEONERROR = 0x1
+
+# Memory access mode:
+# Verify result of memory operations (by reading and comparing).
+MODE_VERIFY = 0x2
+
+class MemoryContext(object):
+ def __init__(self, props):
+ self._props = props or {}
+
+ def __str__(self):
+ return "[Memory Context %s]" % self._props
+
+ def getProperties(self):
+ """
+ Get context properties. See PROP_* definitions for property names.
+ Context properties are read only, clients should not try to modify them.
+ @return Map of context properties.
+ """
+ return self._props
+
+ def getID(self):
+ """
+ Retrieve context ID.
+ Same as getProperties().get('ID')
+ """
+ return self._props.get(PROP_ID)
+
+ def getParentID(self):
+ """
+ Retrieve parent context ID.
+ Same as getProperties().get('ParentID')
+ """
+ return self._props.get(PROP_PARENT_ID)
+
+ def getProcessID(self):
+ """
+ Retrieve context process ID.
+ Same as getProperties().get('ProcessID')
+ """
+ return self._props.get(PROP_PROCESS_ID)
+
+ def isBigEndian(self):
+ """
+ Get memory endianness.
+ @return True if memory is big-endian.
+ """
+ return self._props.get(PROP_BIG_ENDIAN, False)
+
+ def getAddressSize(self):
+ """
+ Get memory address size.
+ @return number of bytes used to store memory address value.
+ """
+ return self._props.get(PROP_ADDRESS_SIZE, 0)
+
+ def getName(self):
+ """
+ Get memory context name.
+ The name can be used for UI purposes.
+ @return context name.
+ """
+ return self._props.get(PROP_NAME)
+
+ def getStartBound(self):
+ """
+ Get lowest address (inclusive) which is valid for the context.
+ @return lowest address.
+ """
+ return self._props.get(PROP_START_BOUND)
+
+ def getEndBound(self):
+ """
+ Get highest address (inclusive) which is valid for the context.
+ @return highest address.
+ """
+ return self._props.get(PROP_END_BOUND)
+
+ def getAccessTypes(self):
+ """
+ Get the access types allowed for this context.
+ @return collection of access type names.
+ """
+ return self._props.get(PROP_ACCESS_TYPES)
+
+ def set(self, addr, word_size, buf, offs, size, mode, done):
+ """
+ Set target memory.
+ If 'word_size' is 0 it means client does not care about word size.
+ """
+ raise NotImplementedError("Abstract method")
+
+ def get(self, addr, word_size, buf, offs, size, mode, done):
+ """
+ Read target memory.
+ """
+ raise NotImplementedError("Abstract method")
+
+ def fill(self, addr, word_size, value, size, mode, done):
+ """
+ Fill target memory with given pattern.
+ 'size' is number of bytes to fill.
+ """
+ raise NotImplementedError("Abstract method")
+
+class DoneMemory(object):
+ """
+ Client call back interface for set(), get() and fill() commands.
+ """
+ def doneMemory(self, token, error):
+ pass
+
+class MemoryError(Exception):
+ pass
+
+class ErrorOffset(object):
+ """
+ ErrorOffset may be implemented by MemoryError object,
+ which is returned by get, set and fill commands.
+
+ get/set/fill () returns this exception when reading failed
+ for some but not all bytes, and MODE_CONTINUEONERROR
+ has been set in mode. (For example, when only part of the request
+ translates to valid memory addresses.)
+ Exception.getMessage can be used for generalized message of the
+ 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_CANNOT_WRITE = 0x08
+
+ RANGE_KEY_ADDR = "addr"
+ RANGE_KEY_SIZE = "size"
+ RANGE_KEY_STAT = "stat"
+ RANGE_KEY_MSG = "msg"
+
+ def getStatus(self, offset):
+ raise NotImplementedError("Abstract method")
+
+ def getMessage(self, offset):
+ raise NotImplementedError("Abstract method")
+
+class MemoryService(services.Service):
+ def getName(self):
+ return NAME
+
+ def getContext(self, id, done):
+ """
+ Retrieve context info for given context ID.
+
+ @param id - context ID.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ raise NotImplementedError("Abstract method")
+
+ 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.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ raise NotImplementedError("Abstract method")
+
+ def addListener(self, listener):
+ """
+ Add memory service event listener.
+ @param listener - event listener implementation.
+ """
+ raise NotImplementedError("Abstract method")
+
+ def removeListener(self, listener):
+ """
+ Remove memory service event listener.
+ @param listener - event listener implementation.
+ """
+ raise NotImplementedError("Abstract method")
+
+class MemoryListener(object):
+ """
+ Memory event listener is notified when memory context hierarchy
+ changes, and when memory is modified by memory service commands.
+ """
+
+ def contextAdded(self, contexts):
+ """
+ Called when a new memory access context(s) is created.
+ """
+ pass
+
+ def contextChanged(self, contexts):
+ """
+ Called when a memory access context(s) properties changed.
+ """
+ pass
+
+ def contextRemoved(self, context_ids):
+ """
+ Called when memory access context(s) is removed.
+ """
+ pass
+
+ def memoryChanged(self, context_id, addr, size):
+ """
+ Called when target memory content was changed and clients
+ need to update themselves. Clients, at least, should invalidate
+ corresponding cached memory data.
+ Not every change is notified - it is not possible,
+ only those, which are not caused by normal execution of the debuggee.
+ 'addr' and 'size' can be None if unknown.
+ """
+ pass
+
+class DoneGetContext(object):
+ """
+ Client call back interface for getContext().
+ """
+ def doneGetContext(self, token, error, context):
+ """
+ Called when context data retrieval is done.
+ @param error - error description if operation failed, None if succeeded.
+ @param context - context data.
+ """
+ pass
+
+class DoneGetChildren(object):
+ """
+ Client call back interface for getChildren().
+ """
+ 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 context_ids - array of available context IDs.
+ """
+ pass
diff --git a/python/src/tcf/services/memorymap.py b/python/src/tcf/services/memorymap.py
new file mode 100644
index 000000000..1c80bad96
--- /dev/null
+++ b/python/src/tcf/services/memorymap.py
@@ -0,0 +1,188 @@
+# *******************************************************************************
+# * Copyright (c) 2011 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
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * Wind River Systems - initial API and implementation
+# *******************************************************************************
+
+"""
+MemoryMap service provides information about executable modules (files) mapped (loaded) into target memory.
+"""
+
+from tcf import services
+
+NAME = "MemoryMap"
+
+
+# Memory region property names.
+# Number, region address in memory
+PROP_ADDRESS = "Addr"
+
+# Number, region size
+PROP_SIZE = "Size"
+
+# Number, region offset in the file
+PROP_OFFSET = "Offs"
+
+# Boolean, true if the region represents BSS
+PROP_BSS = "BSS"
+
+# Number, region memory protection flags, see FLAG_*
+PROP_FLAGS = "Flags"
+
+# String, name of the file
+PROP_FILE_NAME = "FileName"
+
+# String, name of the object file section
+PROP_SECTION_NAME = "SectionName"
+
+# Memory region flags.
+# Read access is allowed
+FLAG_READ = 1
+
+# Write access is allowed
+FLAG_WRITE = 2
+
+# Instruction fetch access is allowed
+FLAG_EXECUTE = 4
+
+class MemoryRegion(object):
+ """Memory region object."""
+
+ def __init__(self, props):
+ self._props = props
+
+ def getProperties(self):
+ """
+ Get region properties. See PROP_* definitions for property names.
+ Properties are read only, clients should not try to modify them.
+ @return Map of region properties.
+ """
+ self._props
+
+ def getAddress(self):
+ """
+ Get memory region address.
+ @return region address.
+ """
+ return self._props.get(PROP_ADDRESS)
+
+ def getSize(self):
+ """
+ Get memory region size.
+ @return region size.
+ """
+ return self._props.get(PROP_SIZE)
+
+ def getOffset(self):
+ """
+ Get memory region file offset.
+ @return file offset.
+ """
+ return self._props.get(PROP_OFFSET)
+
+ def getFlags(self):
+ """
+ Get memory region flags.
+ @return region flags.
+ """
+ return self._props.get(PROP_FLAGS, 0)
+
+ def getFileName(self):
+ """
+ Get memory region file name.
+ @return file name.
+ """
+ return self._props.get(PROP_FILE_NAME)
+
+ def getSectionName(self):
+ """
+ Get memory region section name.
+ @return section name.
+ """
+ return self._props.get(PROP_SECTION_NAME)
+
+ def __json__(self):
+ # This makes it serializable using JSON serializer
+ return self._props
+
+ def __repr__(self):
+ return "MemoryRegion(%s)" % str(self._props)
+ __str__ = __repr__
+
+class MemoryMapService(services.Service):
+ def getName(self):
+ return NAME
+
+ def get(self, id, done):
+ """
+ Retrieve memory map for given context ID.
+
+ @param id - 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):
+ """
+ Set memory map for given context ID.
+
+ @param id - context ID.
+ @param map - memory map data.
+ @param done - call back interface called when operation is completed.
+ @return - pending command handle.
+ """
+ return NotImplementedError("Abstract method")
+
+ def addListener(self, listener):
+ """
+ Add memory map event listener.
+ @param listener - memory map event listener to add.
+ """
+ return NotImplementedError("Abstract method")
+
+ def removeListener(self, listener):
+ """
+ Remove memory map event listener.
+ @param listener - memory map event listener to remove.
+ """
+ return NotImplementedError("Abstract method")
+
+class DoneGet(object):
+ """
+ Client call back interface for get().
+ """
+ def doneGet(self, token, error, map):
+ """
+ Called when memory map data retrieval is done.
+ @param error - error description if operation failed, null if succeeded.
+ @param map - memory map data.
+ """
+ pass
+
+class DoneSet(object):
+ """
+ Client call back interface for set().
+ """
+ def doneSet(self, token, error):
+ """
+ Called when memory map set command is done.
+ @param error - error description if operation failed, null if succeeded.
+ """
+ pass
+
+class MemoryMapListener(object):
+ """
+ Service events listener interface.
+ """
+ def changed(self, context_id):
+ """
+ Called when context memory map changes.
+ @param context_id - context ID.
+ """
+ pass
diff --git a/python/src/tcf/services/processes.py b/python/src/tcf/services/processes.py
index e2e1a8a6a..d5ddef0ca 100644
--- a/python/src/tcf/services/processes.py
+++ b/python/src/tcf/services/processes.py
@@ -21,7 +21,6 @@ available for client to read/write using Streams service. Stream type of such
streams is set to "Processes".
"""
-import exceptions
from tcf import services
NAME = "Processes"
@@ -82,23 +81,23 @@ class ProcessesService(services.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
-
+
@param id - context ID.
@param done - call back interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getChildren(self, parent_context_id, attached_only, done):
"""
Retrieve children of given context.
-
+
@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 getContext or getChildren commands.
@param attached_only - if True return only attached process IDs.
@param done - call back interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getSignalList(self, context_id, done):
"""
@@ -107,7 +106,7 @@ class ProcessesService(services.Service):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getSignalMask(self, context_id, done):
"""
@@ -118,7 +117,7 @@ class ProcessesService(services.Service):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def setSignalMask(self, context_id, dont_stop, dont_pass, done):
"""
@@ -131,7 +130,7 @@ class ProcessesService(services.Service):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def signal(self, context_id, signal, done):
"""
@@ -141,7 +140,7 @@ class ProcessesService(services.Service):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getEnvironment(self, done):
"""
@@ -149,7 +148,7 @@ class ProcessesService(services.Service):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def start(self, directory, file, command_line, environment, attach, done):
"""
@@ -165,21 +164,21 @@ class ProcessesService(services.Service):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def addListener(self, listener):
"""
Add processes service event listener.
@param listener - event listener implementation.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def removeListener(self, listener):
"""
Remove processes service event listener.
@param listener - event listener implementation.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class ProcessContext(object):
@@ -188,7 +187,7 @@ class ProcessContext(object):
def __str__(self):
return "[Processes Context %s]" % self._props
-
+
def getProperties(self):
"""
Get context properties. See PROP_* definitions for property names.
@@ -240,7 +239,7 @@ class ProcessContext(object):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def detach(self, done):
"""
@@ -249,7 +248,7 @@ class ProcessContext(object):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def terminate(self, done):
"""
@@ -257,7 +256,7 @@ class ProcessContext(object):
@param done - call back interface called when operation is completed.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneCommand(object):
"""
diff --git a/python/src/tcf/services/registers.py b/python/src/tcf/services/registers.py
index a350753d5..6b8e9556b 100644
--- a/python/src/tcf/services/registers.py
+++ b/python/src/tcf/services/registers.py
@@ -13,7 +13,6 @@
Registers service provides access to target CPU register values and properties.
"""
-import exceptions
from tcf import services
NAME = "Registers"
@@ -63,7 +62,7 @@ class RegistersContext(object):
def __str__(self):
return "[Registers Context %s]" % self._props
-
+
def getProperties(self):
"""
Get context properties. See PROP_* definitions for property names.
@@ -243,7 +242,7 @@ class RegistersContext(object):
@param done - call back object.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def set(self, value, done):
"""
@@ -252,7 +251,7 @@ class RegistersContext(object):
@param done - call back object.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def search(self, filter, done):
"""
@@ -262,7 +261,7 @@ class RegistersContext(object):
@param done - call back object.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class RegistersService(services.Service):
@@ -272,11 +271,11 @@ class RegistersService(services.Service):
def getContext(self, id, done):
"""
Retrieve context info for given context ID.
-
+
@param id - context ID.
@param done - call back interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getChildren(self, parent_context_id, done):
"""
@@ -288,13 +287,13 @@ class RegistersService(services.Service):
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.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getm(self, locs, done):
"""
@@ -303,8 +302,8 @@ class RegistersService(services.Service):
@param done - call back object.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
-
+ raise NotImplementedError("Abstract method")
+
def setm(self, locs, value, done):
"""
Set values of multiple locations in registers.
@@ -313,21 +312,21 @@ class RegistersService(services.Service):
@param done - call back object.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def addListener(self, listener):
"""
Add registers service event listener.
@param listener - event listener implementation.
"""
- raise exceptions.NotImplementedError("Abstract method")
-
+ raise NotImplementedError("Abstract method")
+
def removeListener(self, listener):
"""
Remove registers service event listener.
@param listener - event listener implementation.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class NamedValue(object):
diff --git a/python/src/tcf/services/remote/BreakpointsProxy.py b/python/src/tcf/services/remote/BreakpointsProxy.py
index 35cec5c5b..7111c5a48 100644
--- a/python/src/tcf/services/remote/BreakpointsProxy.py
+++ b/python/src/tcf/services/remote/BreakpointsProxy.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import channel
from tcf.services import breakpoints
from tcf.channel.Command import Command
@@ -46,7 +45,7 @@ class ChannelEventListener(channel.EventListener):
self.listener.contextRemoved(args[0])
else:
raise IOError("Breakpoints service: unknown event: " + name);
- except exceptions.Exception as x:
+ except Exception as x:
self.service.channel.terminate(x)
class BreakpointsProxy(breakpoints.BreakpointsService):
diff --git a/python/src/tcf/services/remote/ExpressionsProxy.py b/python/src/tcf/services/remote/ExpressionsProxy.py
index 48a2d313d..064152c01 100644
--- a/python/src/tcf/services/remote/ExpressionsProxy.py
+++ b/python/src/tcf/services/remote/ExpressionsProxy.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import channel
from tcf.services import expressions
from tcf.channel.Command import Command
@@ -130,5 +129,5 @@ class ChannelEventListener(channel.EventListener):
self.listener.valueChanged(args[0])
else:
raise IOError("Expressions service: unknown event: " + name);
- except exceptions.Exception as x:
+ except Exception as x:
self.service.channel.terminate(x)
diff --git a/python/src/tcf/services/remote/FileSystemProxy.py b/python/src/tcf/services/remote/FileSystemProxy.py
index ad626b6e6..27e36a8c4 100644
--- a/python/src/tcf/services/remote/FileSystemProxy.py
+++ b/python/src/tcf/services/remote/FileSystemProxy.py
@@ -132,7 +132,7 @@ class FileSystemProxy(filesystem.FileSystemService):
if not s: a = _toFileAttrs(args[1])
done.doneStat(self.token, s, a)
return StatCommand().token
-
+
def fstat(self, handle, done):
done = self._makeCallback(done)
assert handle.getService() is self
@@ -416,7 +416,7 @@ class FileSystemProxy(filesystem.FileSystemService):
service = self
class CopyCommand(FileSystemCommand):
def __init__(self):
- super(CopyCommand, self).__init__(service, "copy",
+ super(CopyCommand, self).__init__(service, "copy",
(id, src_path, dst_path, copy_permissions, copy_uidgid))
def done(self, error, args):
s = None
diff --git a/python/src/tcf/services/remote/LineNumbersProxy.py b/python/src/tcf/services/remote/LineNumbersProxy.py
index 32211ddf2..ad567d225 100644
--- a/python/src/tcf/services/remote/LineNumbersProxy.py
+++ b/python/src/tcf/services/remote/LineNumbersProxy.py
@@ -22,7 +22,7 @@ class LineNumbersProxy(linenumbers.LineNumbersService):
service = self
class MapCommand(Command):
def __init__(self):
- super(MapCommand, self).__init__(service.channel, service,
+ super(MapCommand, self).__init__(service.channel, service,
"mapToSource", (context_id, start_address, end_address))
def done(self, error, args):
arr = None
@@ -38,7 +38,7 @@ class LineNumbersProxy(linenumbers.LineNumbersService):
service = self
class MapCommand(Command):
def __init__(self):
- super(MapCommand, self).__init__(service.channel, service,
+ super(MapCommand, self).__init__(service.channel, service,
"mapToMemory", (context_id, file, line, column))
def done(self, error, args):
arr = None
diff --git a/python/src/tcf/services/remote/LocatorProxy.py b/python/src/tcf/services/remote/LocatorProxy.py
index 4926ee987..89fff33d9 100644
--- a/python/src/tcf/services/remote/LocatorProxy.py
+++ b/python/src/tcf/services/remote/LocatorProxy.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import protocol, peer, channel
from tcf.services import locator
from tcf.channel.Command import Command
@@ -35,25 +34,25 @@ class ChannelEventListener(channel.EventListener):
assert len(args) == 1
peer = Peer(self.channel.getRemotePeer(), args[0])
if self.proxy.peers.get(peer.getID()):
- protocol.log("Invalid peerAdded event", exceptions.Exception())
+ protocol.log("Invalid peerAdded event", Exception())
return
self.proxy.peers[peer.getID()] = peer
for l in self.proxy.listeners:
try:
l.peerAdded(peer)
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Unhandled exception in Locator listener", x)
elif name == "peerChanged":
assert len(args) == 1
m = args[0]
- if not m: raise exceptions.Exception("Locator service: invalid peerChanged event - no peer ID")
+ if not m: raise Exception("Locator service: invalid peerChanged event - no peer ID")
peer = self.proxy.peers.get(m.get(peer.ATTR_ID))
if not peer: return
self.proxy.peers[peer.getID()] = peer
for l in self.proxy.listeners:
try:
l.peerChanged(peer)
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Unhandled exception in Locator listener", x)
elif name == "peerRemoved":
assert len(args) == 1
@@ -64,7 +63,7 @@ class ChannelEventListener(channel.EventListener):
for l in self.proxy.listeners:
try:
l.peerRemoved(id)
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Unhandled exception in Locator listener", x)
elif name == "peerHeartBeat":
assert len(args) == 1
@@ -74,11 +73,11 @@ class ChannelEventListener(channel.EventListener):
for l in self.proxy.listeners:
try:
l.peerHeartBeat(id)
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Unhandled exception in Locator listener", x)
else:
- raise exceptions.IOError("Locator service: unknown event: " + name)
- except exceptions.Exception as x:
+ raise IOError("Locator service: unknown event: " + name)
+ except Exception as x:
self.channel.terminate(x)
class LocatorProxy(locator.LocatorService):
@@ -141,7 +140,7 @@ class LocatorProxy(locator.LocatorService):
for l in service.listeners:
try:
l.peerAdded(peer)
- except exceptions.Exception as x:
+ except Exception as x:
protocol.log("Unhandled exception in Locator listener", x)
self.get_peers_done = True
diff --git a/python/src/tcf/services/remote/MemoryMapProxy.py b/python/src/tcf/services/remote/MemoryMapProxy.py
new file mode 100644
index 000000000..9e37feb9b
--- /dev/null
+++ b/python/src/tcf/services/remote/MemoryMapProxy.py
@@ -0,0 +1,84 @@
+# *******************************************************************************
+# * Copyright (c) 2011 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
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * Wind River Systems - initial API and implementation
+# *******************************************************************************
+
+from tcf import channel
+from tcf.services import memorymap
+from tcf.channel.Command import Command
+
+class MemoryMapProxy(memorymap.MemoryMapService):
+ def __init__(self, channel):
+ self.channel = channel
+ self.listeners = {}
+
+ def get(self, id, done):
+ done = self._makeCallback(done)
+ service = self
+ class GetCommand(Command):
+ def __init__(self):
+ super(GetCommand, self).__init__(service.channel, service, "get", (id,))
+ def done(self, error, args):
+ map = None
+ if not error:
+ assert len(args) == 2
+ error = self.toError(args[0])
+ if args[1]: map = _toMemoryMap(args[1])
+ done.doneGet(self.token, error, map)
+ return GetCommand().token
+
+ def set(self, id, map, done):
+ done = self._makeCallback(done)
+ service = self
+ class SetCommand(Command):
+ def __init__(self):
+ super(SetCommand, self).__init__(service.channel, service, "set", (id, map))
+ def done(self, error, args):
+ if not error:
+ assert len(args) == 1
+ error = self.toError(args[0])
+ done.doneSet(self.token, error)
+ return SetCommand().token
+
+ def addListener(self, listener):
+ l = ChannelEventListener(self, listener)
+ self.channel.addEventListener(self, l)
+ self.listeners[listener] = l
+
+ def removeListener(self, listener):
+ l = self.listeners.get(listener)
+ if l:
+ del self.listeners[listener]
+ self.channel.removeEventListener(self, l)
+
+class ChannelEventListener(channel.EventListener):
+ def __init__(self, service, listener):
+ self.service = service
+ self.listener = listener
+ def event(self, name, data):
+ try:
+ args = channel.fromJSONSequence(data)
+ if name == "changed":
+ assert len(args) == 1
+ self.listener.changed(args[0])
+ else:
+ raise IOError("MemoryMap service: unknown event: " + name);
+ except Exception as x:
+ self.service.channel.terminate(x)
+
+
+def _toMemoryMap(o):
+ if o is None: return None
+ map = []
+ for x in o: map.append(_toMemoryRegion(x))
+ return map
+
+def _toMemoryRegion(o):
+ if o is None: return None
+ return memorymap.MemoryRegion(o)
diff --git a/python/src/tcf/services/remote/MemoryProxy.py b/python/src/tcf/services/remote/MemoryProxy.py
new file mode 100644
index 000000000..f2449fcb3
--- /dev/null
+++ b/python/src/tcf/services/remote/MemoryProxy.py
@@ -0,0 +1,249 @@
+# *******************************************************************************
+# * Copyright (c) 2011 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
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * Wind River Systems - initial API and implementation
+# *******************************************************************************
+
+from tcf import errors, channel
+from tcf.services import memory
+from tcf.channel.Command import Command
+
+class Range(object):
+ offs = 0
+ size = 0
+ stat = 0
+ msg = None
+ def __cmp__(self, o):
+ if self.offs < o.offs: return -1
+ if self.offs > o.offs: return +1
+ return 0
+
+class MemoryErrorReport(errors.ErrorReport, memory.MemoryError, memory.ErrorOffset):
+ def __init__(self, msg, attrs, addr, ranges):
+ super(MemoryErrorReport, self).__init__(msg, attrs)
+ if ranges is None:
+ self.ranges = None
+ else:
+ self.ranges = []
+ for m in ranges:
+ r = Range()
+ x = m.get(memory.ErrorOffset.RANGE_KEY_ADDR)
+ if isinstance(x, str):
+ y = int(x)
+ else:
+ y = x
+ r.offs = y - addr
+ r.size = m.get(memory.ErrorOffset.RANGE_KEY_SIZE)
+ r.stat = m.get(memory.ErrorOffset.RANGE_KEY_STAT)
+ r.msg = errors.toErrorString(m.get(memory.ErrorOffset.RANGE_KEY_MSG))
+ assert r.offs >= 0
+ assert r.size >= 0
+ self.ranges.append(r)
+ self.ranges.sort()
+
+ def getMessage(self, offset):
+ if self.ranges is None: return None
+ l = 0
+ h = len(self.ranges) - 1
+ while l <= h:
+ n = (l + h) / 2
+ r = self.ranges[n]
+ if r.offs > offset:
+ h = n - 1
+ elif offset >= r.offs + r.size:
+ l = n + 1
+ else:
+ return r.msg
+ return None
+
+ def getStatus(self, offset):
+ if self.ranges is None: return memory.ErrorOffset.BYTE_UNKNOWN
+ l = 0
+ h = len(self.ranges) - 1
+ while l <= h:
+ n = (l + h) / 2
+ r = self.ranges[n]
+ if r.offs > offset:
+ h = n - 1
+ elif offset >= r.offs + r.size:
+ l = n + 1
+ else:
+ return r.stat
+ return memory.ErrorOffset.BYTE_UNKNOWN
+
+
+class MemContext(memory.MemoryContext):
+ def __init__(self, service, props):
+ super(MemContext, self).__init__(props)
+ self.service = service
+
+ def fill(self, addr, word_size, value, size, mode, done):
+ service = self.service
+ id = self.getID()
+ done = service._makeCallback(done)
+ class FillCommand(MemoryCommand):
+ def __init__(self):
+ super(FillCommand, self).__init__(service,
+ "fill", (id, addr, word_size, size, mode, value))
+ def done(self, error, args):
+ e = None
+ if error:
+ e = memory.MemoryError(error.message)
+ else:
+ assert len(args) == 2
+ e = self.toMemoryError(args[0], args[1])
+ done.doneMemory(self.token, e)
+ return FillCommand().token
+
+ def get(self, addr, word_size, buf, offs, size, mode, done):
+ service = self.service
+ id = self.getID()
+ done = service._makeCallback(done)
+ class GetCommand(MemoryCommand):
+ def __init__(self):
+ super(GetCommand, self).__init__(service,
+ "get", (id, addr, word_size, size, mode))
+ def done(self, error, args):
+ e = None
+ if error:
+ e = memory.MemoryError(error.message)
+ else:
+ assert len(args) == 3
+ bytes = channel.toByteArray(args[0])
+ assert len(bytes) <= size
+ buf[offs:offs+len(bytes)] = bytes
+ e = self.toMemoryError(args[1], args[2])
+ done.doneMemory(self.token, e)
+ return GetCommand().token
+
+ def set(self, addr, word_size, buf, offs, size, mode, done):
+ service = self.service
+ id = self.getID()
+ done = service._makeCallback(done)
+ class SetCommand(MemoryCommand):
+ def __init__(self):
+ super(SetCommand, self).__init__(service,
+ "set", (id, addr, word_size, size, mode, bytearray(buf[offs:offs:size])))
+ def done(self, error, args):
+ e = None
+ if error:
+ e = memory.MemoryError(error.message)
+ else:
+ assert len(args) == 2
+ e = self.toMemoryError(args[1], args[2])
+ done.doneMemory(self.token, e)
+ return SetCommand().token
+
+class MemoryProxy(memory.MemoryService):
+ def __init__(self, channel):
+ self.channel = channel
+ self.listeners = {}
+
+ def getContext(self, context_id, done):
+ done = self._makeCallback(done)
+ service = self
+ class GetContextCommand(Command):
+ def __init__(self):
+ super(GetContextCommand, self).__init__(service.channel, service, "getContext", (context_id,))
+ def done(self, error, args):
+ ctx = None
+ if not error:
+ assert len(args) == 2
+ error = self.toError(args[0])
+ if args[1]: ctx = MemContext(service, 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,))
+ def done(self, error, args):
+ contexts = None
+ if not error:
+ assert len(args) == 2
+ error = self.toError(args[0])
+ contexts = args[1]
+ done.doneGetChildren(self.token, error, contexts)
+ return GetChildrenCommand().token
+
+ def addListener(self, listener):
+ l = ChannelEventListener(self, listener)
+ self.channel.addEventListener(self, l)
+ self.listeners[listener] = l
+
+ def removeListener(self, listener):
+ l = self.listeners.get(listener)
+ if l:
+ del self.listeners[listener]
+ self.channel.removeEventListener(self, l)
+
+class MemoryCommand(Command):
+ def __init__(self, service, cmd, args):
+ super(MemoryCommand, self).__init__(service.channel, service, cmd, args)
+ def toMemoryError(self, addr, data, ranges):
+ if data is None: return None
+ code = data.get(errors.ERROR_CODE)
+ cmd = self.getCommandString()
+ if len(cmd) > 72: cmd = cmd[0:72] + "..."
+ e = MemoryErrorReport(
+ "TCF command exception:\nCommand: %s\nException: %s\nError code: " % (
+ cmd, self.toErrorString(data), code),
+ map, addr, ranges)
+ caused_by = data.get(errors.ERROR_CAUSED_BY)
+ if caused_by is not None: e.caused_by = self.toError(caused_by, False)
+ return e
+
+
+class ChannelEventListener(channel.EventListener):
+ def __init__(self, service, listener):
+ self.service = service
+ self.listener = listener
+ def event(self, name, data):
+ try:
+ args = channel.fromJSONSequence(data)
+ if name == "contextAdded":
+ assert len(args) == 1
+ self.listener.contextAdded(_toContextArray(args[0]))
+ elif name == "contextChanged":
+ assert len(args) == 1
+ self.listener.contextChanged(_toContextArray(args[0]))
+ elif name == "contextRemoved":
+ assert len(args) == 1
+ self.listener.contextRemoved(args[0])
+ elif name == "memoryChanged":
+ assert len(args) == 2
+ self.listener.memoryChanged(args[0], _toAddrArray(args[1]), _toSizeArray(args[1]))
+ else:
+ raise IOError("Memory service: unknown event: " + name);
+ except Exception as x:
+ self.service.channel.terminate(x)
+
+
+def _toContextArray(o):
+ if o is None: return None
+ ctx = []
+ for m in o: ctx.append(MemContext(m))
+ return ctx
+
+def _toSizeArray(o):
+ if o is None: return None
+ a = []
+ for m in o:
+ sz = m.get("size", 0)
+ a.append(sz)
+ return a
+
+def _toAddrArray(o):
+ if o is None: return None
+ a = []
+ for m in o:
+ a.append(m.get("addr"))
+ return a
diff --git a/python/src/tcf/services/remote/ProcessesProxy.py b/python/src/tcf/services/remote/ProcessesProxy.py
index b4155ffef..baad634b6 100644
--- a/python/src/tcf/services/remote/ProcessesProxy.py
+++ b/python/src/tcf/services/remote/ProcessesProxy.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import channel
from tcf.services import processes
from tcf.channel.Command import Command
@@ -53,7 +52,7 @@ class ProcessesProxy(processes.ProcessesService):
service = self
class GetChildrenCommand(Command):
def __init__(self):
- super(GetChildrenCommand, self).__init__(service.channel, service,
+ super(GetChildrenCommand, self).__init__(service.channel, service,
"getChildren", (parent_context_id, attached_only))
def done(self, error, args):
contexts = None
@@ -196,7 +195,7 @@ class ChannelEventListener(channel.EventListener):
self.listener.exited(args[0], args[1])
else:
raise IOError("Processes service: unknown event: " + name);
- except exceptions.Exception as x:
+ except Exception as x:
self.service.channel.terminate(x)
def _toEnvStringArray(map):
diff --git a/python/src/tcf/services/remote/RegistersProxy.py b/python/src/tcf/services/remote/RegistersProxy.py
index ae2cfd4e0..f33eea147 100644
--- a/python/src/tcf/services/remote/RegistersProxy.py
+++ b/python/src/tcf/services/remote/RegistersProxy.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import channel
from tcf.services import registers
from tcf.channel import toByteArray
@@ -19,7 +18,7 @@ class Context(registers.RegistersContext):
def __init__(self, service, props):
super(Context, self).__init__(props)
self.service = service
-
+
def getNamedValues(self):
return _toValuesArray(self._props.get(registers.PROP_VALUES))
@@ -173,5 +172,5 @@ class ChannelEventListener(channel.EventListener):
self.listener.registerChanged(args[0])
else:
raise IOError("Registers service: unknown event: " + name);
- except exceptions.Exception as x:
+ except Exception as x:
self.service.channel.terminate(x)
diff --git a/python/src/tcf/services/remote/RunControlProxy.py b/python/src/tcf/services/remote/RunControlProxy.py
index d7606c74a..f3aa8ac5e 100644
--- a/python/src/tcf/services/remote/RunControlProxy.py
+++ b/python/src/tcf/services/remote/RunControlProxy.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import channel
from tcf.services import runcontrol
from tcf.channel.Command import Command
@@ -85,10 +84,10 @@ class ChannelEventListener(channel.EventListener):
self.listener.contextResumed(args[0])
elif name == "contextAdded":
assert len(args) == 1
- self.listener.contextAdded(args[0])
+ self.listener.contextAdded(_toContextArray(args[0]))
elif name == "contextChanged":
assert len(args) == 1
- self.listener.contextChanged(args[0])
+ self.listener.contextChanged(_toContextArray(args[0]))
elif name == "contextRemoved":
assert len(args) == 1
self.listener.contextRemoved(args[0])
@@ -103,7 +102,7 @@ class ChannelEventListener(channel.EventListener):
self.listener.containerResumed(args[0])
else:
raise IOError("RunControl service: unknown event: " + name);
- except exceptions.Exception as x:
+ except Exception as x:
self.service.channel.terminate(x)
class RunControlProxy(runcontrol.RunControlService):
@@ -151,3 +150,9 @@ class RunControlProxy(runcontrol.RunControlService):
contexts = args[1]
done.doneGetChildren(self.token, error, contexts)
return GetChildrenCommand().token
+
+def _toContextArray(o):
+ if o is None: return None
+ ctx = []
+ for m in o: ctx.append(RunContext(m))
+ return ctx
diff --git a/python/src/tcf/services/runcontrol.py b/python/src/tcf/services/runcontrol.py
index a80585d1c..cd48f40fe 100644
--- a/python/src/tcf/services/runcontrol.py
+++ b/python/src/tcf/services/runcontrol.py
@@ -9,7 +9,6 @@
# * Wind River Systems - initial API and implementation
# *******************************************************************************
-import exceptions
from tcf import services
NAME = "RunControl"
@@ -159,39 +158,39 @@ class RunControlService(services.Service):
def getContext(self, id, done):
"""
Retrieve context properties for given context ID.
-
+
@param id - context ID.
@param done - callback interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getChildren(self, parent_context_id, done):
"""
Retrieve children of given context.
-
+
@param parent_context_id - parent context ID. Can be null -
to retrieve top level of the hierarchy, or one of context IDs retrieved
by previous getContext or getChildren commands.
@param done - callback interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def addListener(self, listener):
"""
Add run control event listener.
@param listener - run control event listener to add.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def removeListener(self, listener):
"""
Remove run control event listener.
@param listener - run control event listener to remove.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
-class RunControlError(exceptions.Exception):
+class RunControlError(Exception):
pass
class DoneGetState(object):
@@ -251,7 +250,7 @@ class RunControlContext(object):
def __str__(self):
return "[Run Control Context %s]" % self._props
-
+
def getProperties(self):
"""
Get context properties. See PROP_* definitions for property names.
@@ -375,7 +374,7 @@ class RunControlContext(object):
@param done - command result call back object.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def suspend(self, done):
"""
@@ -384,7 +383,7 @@ class RunControlContext(object):
@param done - command result call back object.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
# def resume(self, mode, count, done):
# """
@@ -395,7 +394,7 @@ class RunControlContext(object):
# @param done - command result call back object.
# @return pending command handle, can be used to cancel the command.
# """
-# raise exceptions.NotImplementedError("Abstract method")
+# raise NotImplementedError("Abstract method")
def resume(self, mode, count, params, done):
"""
@@ -407,7 +406,7 @@ class RunControlContext(object):
@param done - command result call back object.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def terminate(self, done):
"""
@@ -415,7 +414,7 @@ class RunControlContext(object):
@param done - command result call back object.
@return pending command handle, can be used to cancel the command.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class RunControlListener(object):
"Service events listener interface."
@@ -456,7 +455,7 @@ class RunControlListener(object):
"""
Called when target simultaneously suspends multiple threads in a container
(process, core, etc.).
-
+
@param context - ID of a context responsible for the event. It can be container ID or
any one of container children, for example, it can be thread that hit "suspend all" breakpoint.
Client expected to move focus (selection) to this context.
@@ -470,7 +469,7 @@ class RunControlListener(object):
"""
Called when target simultaneously resumes multiple threads in a container (process,
core, etc.).
-
+
@param context_ids - full list of all contexts that were resumed.
"""
pass
diff --git a/python/src/tcf/services/stacktrace.py b/python/src/tcf/services/stacktrace.py
index 1cb47b363..f0d477825 100644
--- a/python/src/tcf/services/stacktrace.py
+++ b/python/src/tcf/services/stacktrace.py
@@ -4,12 +4,11 @@
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
# * http://www.eclipse.org/legal/epl-v10.html
-# *
+# *
# * Contributors:
# * Wind River Systems - initial API and implementation
#******************************************************************************
-import exceptions
from tcf import services
NAME = "StackTrace"
@@ -32,19 +31,19 @@ PROP_ARGUMENTS_ADDRESS = "ArgsAddr" # Number, memory address of function argu
class StackTraceService(services.Service):
def getName(self):
return NAME
-
+
def getContext(self, ids, done):
"""
Retrieve context info for given context IDs.
-
+
The command will fail if parent thread is not suspended.
Client can use Run Control service to suspend a thread.
-
+
@param ids - array of context IDs.
@param done - call back interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
-
+ raise NotImplementedError("Abstract method")
+
def getChildren(self, parent_context_id, done):
"""
Retrieve stack trace context list.
@@ -52,14 +51,14 @@ class StackTraceService(services.Service):
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.
-
+
@param parent_context_id - parent context ID.
@param done - call back interface called when operation is completed.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneGetContext(object):
"""
@@ -92,7 +91,7 @@ class StackTraceContext(object):
"""
def __init__(self, props):
self._props = props or {}
-
+
def __str__(self):
return "[Stack Trace Context %s]" % self._props
@@ -102,7 +101,7 @@ class StackTraceContext(object):
@return context ID.
"""
return self._props.get(PROP_ID)
-
+
def getParentID(self):
"""
Get parent context ID.
diff --git a/python/src/tcf/services/symbols.py b/python/src/tcf/services/symbols.py
index 2f03f7402..807ee6cca 100644
--- a/python/src/tcf/services/symbols.py
+++ b/python/src/tcf/services/symbols.py
@@ -4,12 +4,11 @@
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
# * http://www.eclipse.org/legal/epl-v10.html
-# *
+# *
# * Contributors:
# * Wind River Systems - initial API and implementation
#******************************************************************************
-import exceptions
from tcf import services
# Service name.
@@ -81,7 +80,7 @@ class Symbol(object):
def __str__(self):
return "[Symbol Context %s]" % self._props
-
+
def getID(self):
"""
Get symbol ID.
@@ -222,7 +221,7 @@ class Symbol(object):
@return register ID or null.
"""
return self._props.get(PROP_REGISTER)
-
+
def getProperties(self):
"""
Get complete map of context properties.
@@ -233,17 +232,17 @@ class Symbol(object):
class SymbolsService(services.Service):
def getName(self):
return NAME
-
+
def getContext(self, id, done):
"""
Retrieve symbol context info for given symbol ID.
@see Symbol
-
+
@param id - symbol context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def getChildren(self, parent_context_id, done):
"""
@@ -251,48 +250,48 @@ class SymbolsService(services.Service):
Meaning of the operation depends on parent kind:
1. struct, union, or class type - get fields
2. enumeration type - get enumerators
-
+
@param parent_context_id - parent symbol context ID.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def find(self, context_id, ip, name, done):
"""
Search symbol with given name in given context.
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 name - symbol name.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def findByAddr(self, context_id, addr, done):
"""
Search symbol with given address in given context.
The context can be memory space, process, thread or stack frame.
-
+
@param context_id - a search scope.
@param addr - symbol address.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def list(self, context_id, done):
"""
List all symbols in given context.
The context can be a stack frame.
-
+
@param context_id - a scope.
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
def findFrameInfo(self, context_id, address, done):
"""
@@ -302,7 +301,7 @@ class SymbolsService(services.Service):
@param done - call back interface called when operation is completed.
@return - pending command handle.
"""
- raise exceptions.NotImplementedError("Abstract method")
+ raise NotImplementedError("Abstract method")
class DoneGetContext(object):
"""

Back to the top