This is a brief description of the TCF Linux user-mode agent prototype implementation. The agent is implemented as an event driven program. The main event queue is handled by a single thread – the event dispatch thread. Some sub-systems are using other threads locally, but will never call other sub-systems using these threads. Instead an event will be placed on the main event queue to handle the inter sub-system communication.

# Main Program

Main program parses command line options and initialized sub-systems

Files:

main.c

# Target Communication Framework

## Command and Event Registration and Dispatch

This module handles registration of command and event handlers. It is called when new messages are received and will dispatch messages to the appropriate handler. It has no knowledge of what transport protocol is used and what services do.

Files:

protocol.c

protocol.h

## Transport Layer

Implements input and output stream over TCP/IP transport and UDP based server side auto discovery.

Files:

channel.c

channel.h

tcf.h

## Input and Output Stream Interface and Library

This module defines the input and output stream interface and support library functions.

Files:

streams.c

streams.h

# Services

## Breakpoint

The breakpoint services implements a global breakpoint list.

Files:

breakpoints.c

breakpoints.h

## Run Control

This module implements the run control service. It builds uses the context module to do low level control of contexts. It implements a “safe queue” which contains events that that should be processed then their context is suspended. Incoming TCF messages are suspended while the safe queue is non-empty and are resumed when the last safe queue entry is handled.

Files:

runctrl.c

runctrl.h

## System Monitoring

This module provides system level monitoring information, similar to the UNIX top or Windows task manager.

Files:

sysmon.c

sysmon.h

## Agent Diagnostics

This service is used to do end-to-end self test from the host to the target.

Files:

diagnostics.c

diagnostics.h

# OS Context Handling

This module handles process/thread OS contexts and their state machine. All ptrace() handling is isolated to here.

Files:

context.c

context.h

# Agent Event Queue

This module implements the main event queue dispatch and queuing. All events are processed by a single thread. Any thread can queue new events.

Files:

events.c

events.h

# Misc

## Command line interpreter

The module allows a user to interact with agent. Current implementation of command line interpreter is incomplete.

Files:

cmdline.c

cmdline.h

## Error message display

This module defines agent error codes in addition to system codes defined in errno.h

Files:

errors.c

errors.h

## Exception Handling

Exception handling. Functionality is similar to C++ try/catch.

Files:

exceptions.c

exceptions.h

## JSON Library

The module contains utility functions for parsing and generating of JSON text. TCF standard services use JSON as messages format. See JSON - Preferred Marshaling for JSON description.

Files:

json.c

json.h

## Double Linked List

Utilitity module to support double linked lists.

Files:

link.h

## Host OS Abstraction

Machine and OS dependend definitions. This module implements host OS abstraction layer that helps make agent code portable between Linux, Windows, VxWorks and potentially other OSes.

Files:

mdep.c

mdep.h

## Malloc Abstraction

Provides local versions of malloc(), realloc() and free().

Files:

myalloc.c

myalloc.h

## Proxy

Proxy service should allow tunneling of TCF messages to another target on behalf of a client. This service intended to be used when a client has no direct access to a target.

Files:

proxy.c

proxy.h

## Test Application

Test application is used by Diagnostics service to run various tests.

Files:

test.c

test.h

## Debug Logging

The module implements logging and tracing that is mostly intended for debugging of the agent.

Files:

trace.c

trace.h

# Architecture