Intel® System Debugger User Guide

ID 648476
Date 06/13/2024
Confidential
Document Table of Contents

Diagnostics

IPC CLI Diagnostics

The following functions are documented as being a part of the DiagnosticsManager class and are available via:

ipc.diagnostic.<function>

A common use of the diagnostic commands could be:

ipc.diagnostic.markExperiment()
   *do something interesting*
ipc.diagnostic.collect()
>>>...Collecting Log Results
...Logging Preset Restored to *previous preset*
...Compiling Payload
...Diagnostic Payload can be found at: *PATH to payload*

Logging

IPC CLI Debug Logging

The following functions are documented as being a part of the LoggerManager class. However, all of these functions are available via:

ipc.logger.<function>

The most frequently used debug configuration commands will be:

ipc.logger.level("ipc","debugall") # to turn on ALL debug information for the IPC CLI
ipc.logger.echo(True) # to echo the output to the screen
ipc.logger.setFile("path_to_log.log") # to send out put to the file
ipc.logger.openipc_echo(True) # to echo the output to the Open IPC log files
... do something interesting
ipc.logger.reset() # put all logging back to defaults

For the CLI logging with debugall you will typically see at least three log messages. CALLER, ENTER, and EXIT.

  • The CALLER should show the first call outside of the ipccli that called the function in the ipccli.

  • The ENTER will show the value of the parameters passed in to the ipccli function.

  • The EXIT will show the code leaving the ipccli function and the value of any data that was created.

For Example:

>>> ipc.threads[0].irdrscan(2,32)
CALLER: File "<stdin>", line 1, in <module>
ENTER: irdrscan(device=0x10003e8L,instruction=0x02, bitCount=32, data=None, writeData=None)
EXIT : irdrscan result = [32b] 0x0A3CA013
[32b] 0x0A3CA013

Here is the complete list of functions available via ipc.logger.<function_​name>:

OpenIPC Debug Logging

The following ipccli commands are intended to allow a user or script access to the logging capabilities implemented within the OpenIPC application. Intended for diagnostic and debug activities. These command are only available when the ipccli is running on top of OpenIPC. Which almost always the case.

In order to gain more insight into internal operations, the OpenIPC implements a logging infrastructure to enable recording of events and operations that occur. These logs may not be useful to end-users, but an OpenIPC developer(s) may ask you to turn on these logs if you encounter a problem.

OpenIPC has the concept of Presets which allows for a group of loggers to be enabled using a Preset Name. Presets include “GeneralDebug”, “All”, “Off”, and “Custom”. The names are fairly self explanatory as to what sort of logging output will be provided from each Preset type.

The “GeneralDebug” preset should cover most logging needs and should be selected by default.

The “All” preset is appropriate to set when low level driver, probe hardware or debug transport issues are suspected.

Use the “Off” preset to turn logging off.

If at first you are not sure which Preset to use, select the “GeneralDebug” Preset.

The Preset setting will be persistent across restart and reconnect. OpenIPC application performance will be impacted by logging. Be sure to turn logging “Off” when no longer needed.

The logging output file(s) will be in a .OpenIPC/Log/Session<#> directory within your user directory. The latest logs will be in the directory with the largest <#>.

By default, the logging output file(s) will be stored in an .OpenIPC directory within your OS specific home directory:

Windows:

C:Users<user>.OpenIPC

Linux:

~/.OpenIPC

macOS:

~/.OpenIPC

Here is the complete list of functions available via ipc.logger.<function_​name> for OpenIPC:

ipccli.cli_​logging. openipc_​echo (echoOn = None)

Enable logging to Open IPC log files when echoOn is True (you must use level() to set which loggers are enabled for debug). Disables logging to Open IPC log files when echoOn is False and returns the current state if echoOn is None.

Open IPC uses a logging.xml file to configure its own logging. The Open IPC’s IpcInterface logger must be set to a log level of “Info” or above for log messages from ipccli to be recorded. See Open IPC documentation for further details on configuring Open IPC logging.

Args: echoOn (boolean) - see above.

Returns: None

ipccli.cli_​logging. openipc_​loadpreset (preset)

Load a known logging preset setting that controls the level of detail that OpenIPC will log (logging verbosity).

Call the openipc_​presetnames() command to get a list of available logging presets.

  • The “GeneralDebug” preset should cover most logging needs and should be selected by default.

  • The “All” preset is appropriate to set when low level driver, probe hw or debug transport issues are suspected.

  • Use the “Off” preset to turn logging off

Args: preset (str) - name of an acceptable logging preset

Returns: None

ipccli.cli_​logging. openipc_​flush ( )

Write any pending log messages to disk. Then create a new rollback log file for further messages. This typically happens after the session closes, but this can be used to force a flush and new file.

Args: None

Returns: None

ipccli.cli_​logging. openipc_​clear ( )

Delete the log files in the standard logging directory (free up disk space).

Args: None

Returns: None

ipccli.cli_​logging. openipc_​archive ( )

Creates an archive zip file containing every log file in the standard logging directory and then removes them from the directory. Intended to easily package log files to hand off to another person.

Args: None

Returns: None

ipccli.cli_​logging. openipc_​presetnames ( )

Returns a list of acceptable logging preset names that can be loaded when calling openipc_​loadpreset()

Args: None

Returns: list of strings

ipccli.cli_​logging. openipc_​writemessage (message)

Writes the specified user message to the OpenIPC log file. Makes it easy to place a marker in the log file to pass specific debug information or to tag the beginning and end of a section of commands of interest.

Args: message (str) - message to write to the log

Returns: None

ipccli.cli_​logging. openipc_​getloadedpreset ( )

Returns the name of the current loaded logging preset. Some preset will always be loaded.

Args: None

Returns: a preset name (str)

IPC CLI STDIO Logging

The following can be used to log all of the output that is being sent to stdout/stderr:

IPC CLI Logging - for Developers

The IPC-CLI logging is built on top of the standard Python logging module and is compatible with (and similar to) the PythonSv logging framework. The primary difference is that IPC-CLI logging is built so that all logging using its logging goes through a parent logger. The parent logger then controls the screen or file output. To get a logger that ties in to the CLI logging, a new logger is requested via:

>>> from ipc import ipc_logging
>>> log = ipc_logging.getLogger("my script")

This will give the caller a logger that is controlled via the ipc.logger functions, such as echo, setFile, and level. The logger will show up in the ipc.logger.show() function as well.

If a script wants its own logging with its own file, then it is recommended to use the python logging module directly or to use the PythonSv logging.

How does the cli_​logging work? It makes all of the logging objects child loggers such that the ipc logger is really named ipccli.ipc. The bitdata logger is really ipccli.bitdata. When we set ipccli.ipc to debugall, then that allows the messages to get to the ipccli logger. Then ipccli will log to the screen or file depending on any echo() or setFile() calls that have been made.