DE102009038177A1 - Method for dynamically activating back trace of sub program in computer system, involves registering inflow in sub program through back trace module, and allowing program control flow to return back to sub program - Google Patents

Method for dynamically activating back trace of sub program in computer system, involves registering inflow in sub program through back trace module, and allowing program control flow to return back to sub program Download PDF

Info

Publication number
DE102009038177A1
DE102009038177A1 DE102009038177A DE102009038177A DE102009038177A1 DE 102009038177 A1 DE102009038177 A1 DE 102009038177A1 DE 102009038177 A DE102009038177 A DE 102009038177A DE 102009038177 A DE102009038177 A DE 102009038177A DE 102009038177 A1 DE102009038177 A1 DE 102009038177A1
Authority
DE
Germany
Prior art keywords
subroutine
trace module
exception handling
program
exception
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
DE102009038177A
Other languages
German (de)
Other versions
DE102009038177B4 (en
Inventor
Johannes Passing
Alexander Schmidt
Martin von Dr. Löwis
Andreas Prof. Dr. Polze
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hasso Plattner Institut fuer Softwaresystemtechnik GmbH
Original Assignee
Hasso Plattner Institut fuer Softwaresystemtechnik GmbH
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hasso Plattner Institut fuer Softwaresystemtechnik GmbH filed Critical Hasso Plattner Institut fuer Softwaresystemtechnik GmbH
Priority to DE102009038177.5A priority Critical patent/DE102009038177B4/en
Publication of DE102009038177A1 publication Critical patent/DE102009038177A1/en
Application granted granted Critical
Publication of DE102009038177B4 publication Critical patent/DE102009038177B4/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

The method involves providing a sub program (184) with a set of instructions, and loading a back trace module in an operating storage unit of a computer system. Machine codes of a null statement of the sub program is replaced in the operating storage unit through a machine code (180) of branch statement that enables switching of program control flow to the back trace module in the operating storage unit. An inflow is registered in the sub program through the back trace module, and the program control flow is allowed to be return back to the sub program.

Description

Die vorliegende Erfindung betrifft eine dynamisch aktivierbare Ablaufverfolgung eines Unterprogramms in einem laufenden Computersystem.The present invention relates to a dynamically activatable trace of a subroutine in a running computer system.

Unterprogramme, manchmal auch als Funktionen, Prozeduren, Routinen oder Subroutinen bezeichnet, stellen in sich abgeschlossene Gruppen von Instruktionen eines Programms dar, die aus dem laufenden Programm heraus aufgerufen werden können und nach Abarbeitung der in dem jeweiligen Unterprogramm befindlichen Instruktionen wieder zu der aufrufenden Stelle im Programm zurückkehren. Das Programm kann dabei das den Computer betreibende Betriebssystem, ein bestimmtes Modul dieses Betriebssystems, ein auf dem Computer unter Zuhilfenahme des Betriebssystems laufendes Anwendungsprogramm oder ein bestimmtes Modul dieses Anwendungsprogramms darstellen.Subprograms, sometimes referred to as functions, procedures, routines, or subroutines, represent self-contained sets of instructions of a program which can be called from the running program and, after execution of the instructions in the respective subroutine, return to the calling location in the program Return program. The program may represent the operating system operating the computer, a specific module of this operating system, an application program running on the computer with the aid of the operating system or a specific module of this application program.

Falls bei der Ausführung solcher Programme Fehler auftreten, ist es notwendig, die Ursache dieses Fehlers herauszufinden. Dies gilt besonders für die Entwicklungsphase eines Programms bzw. Programmmoduls, um möglichst viele Fehlerquellen frühzeitig zu erkennen und zu beseitigen, bevor das Programm bzw. Programmmodul fertiggestellt und ausgeliefert wird. Es ist aber auch für die spätere Anwendungsphase eines Programms bzw. Programmmoduls notwendig, in einer bestimmten Umgebung auftretende Fehlerursachen aufspüren und evtl. bereinigen zu können. Zu diesem Zweck wird die so genannte Ablaufverfolgung eingesetzt, die den Eintritt in ein bestimmtes Unterprogramm und den Austritt aus diesem Unterprogramm registriert, sodass beim Auftritt eines Fehlers im Ablauf eines Programms bzw. Programmmoduls festgestellt werden kann, bei welchem Unterprogramm der Fehler aufgetreten ist. Der Ein- bzw. Austritt kann dabei durch ein zeitliches Protokollieren bzw. Aufzeichnen, Hoch- bzw. Herunterzählen eines Zählers oder eine andere Maßnahme registriert werden, die eine Zuordnung zu dem jeweiligen Unterprogramm ermöglicht.If errors occur during the execution of such programs, it is necessary to find out the cause of this error. This applies in particular to the development phase of a program or program module, in order to recognize and eliminate as many sources of error as possible in good time, before the program or program module is completed and delivered. However, it is also necessary for the later application phase of a program or program module to detect error causes occurring in a specific environment and possibly be able to clean them up. For this purpose, the so-called tracing is used, which registers the entry into a specific subroutine and the exit from this subroutine, so that when an error occurs in the course of a program or program module can determine which subroutine the error has occurred. The entry or exit can be registered by a chronological logging or recording, counting up or down a counter or another measure that allows an assignment to the respective subroutine.

Um die Ablaufverfolgung eines Unterprogramms zu ermöglichen, ist es notwendig, dieses Unterprogramm zu instrumentieren. Dies kann dadurch erreicht werden, dass bereits bei der Programmerstellung spezielle Anweisungen in den Programmcode eingebracht werden, die später die Ablaufverfolgung ermöglichen. Damit ist eine Ablaufverfolgung allerdings nur für solche Unterprogramme eines Programms möglich, für die dies bereits während der Programmierung vorgesehen wurde und in denen sich somit die für die Ablaufverfolgung notwendigen Instruktionen bereits zur Kompilierzeit im Programmcode befinden.In order to enable the tracing of a subroutine, it is necessary to instrument this subroutine. This can be achieved by introducing special instructions into the program code already during the program creation which later enable the trace. However, a trace is only possible for such subroutines of a program for which this was already provided during the programming and in which thus the instructions necessary for the trace are already in the program code at compile time.

Es ist auch möglich, ein Unterprogramm nach Kompilierung des entsprechenden Programms bzw. Programmmoduls für eine Ablaufverfolgung zu instrumentieren. Für eine solche dynamische Instrumentierung ist es notwendig, den bereits im Arbeitsspeicher des Computersystems befindlichen Maschinencode des Programms zu manipulieren. Dabei muss beachtet werden, dass der Maschinencode eines kompilierten Programms bzw. Programmmoduls eine kohärente Bitfolge darstellt und daher zusätzliche Instruktionen nicht ohne Weiteres in den Maschinencode eingefügt werden können ohne dessen Integrität zu beschädigen.It is also possible to instrument a subroutine after compilation of the corresponding program or program module for a trace. For such dynamic instrumentation, it is necessary to manipulate the machine code of the program already resident in the main memory of the computer system. It should be noted that the machine code of a compiled program or program module represents a coherent bit sequence and therefore additional instructions can not be easily inserted into the machine code without damaging its integrity.

Um eine solche Beschädigung zu verhindern, schlägt der aus US 7,047,521 B2 bekannte Stand der Technik vor, die Anfangsinstruktionen eines im Arbeitsspeicher in Maschinencode befindlichen Unterprogramms, welches für eine Ablaufverfolgung dynamisch instrumentiert werden soll, mit einer Sprunganweisung zu überschreiben und die von der Sprunganweisung verdrängten Anfangsinstruktionen in einen Pufferspeicher zu kopieren. Bei Aufruf des Unterprogramms wird der Kontrollfluss durch die Sprunganweisung auf ein Ablaufverfolgungsprogramm gelenkt, das den Eintritt in das Unterprogramm protokolliert und daraufhin den Kontrollfluss auf den Pufferspeicher umlenkt, der die durch den Sprungbefehl verdrängten Instruktionen enthält. Nach Abarbeitung dieser Instruktionen wird an die Instruktion des Unterprogramms zurückgesprungen, die den verdrängten Instruktionen folgt. Nach dem Einfügen des Sprungbefehls und der Speicherung der verdrängten Instruktionen in einen Pufferspeicher ist die funktionale Integrität des Unterprogramms wiederhergestellt.To prevent such damage, proposes the US 7,047,521 B2 It is known in the prior art to overwrite the initial instructions of a subroutine in machine code which is to be dynamically instrumented for a trace with a jump instruction and to copy the initial instructions displaced by the jump instruction into a buffer memory. Upon invocation of the subroutine, the control flow through the jump instruction is directed to a trace program that logs entry into the subroutine and then redirects the control flow to the buffer containing the instructions displaced by the jump instruction. After execution of these instructions, the instruction of the subprogram which follows the displaced instructions is jumped back to. After inserting the jump instruction and storing the displaced instructions in a buffer memory, the functional integrity of the subroutine is restored.

Nachteilig ist bei diesem Verfahren jedoch, dass für den Zeitraum, indem die zu verdrängenden Instruktionen in den Pufferspeicher geschrieben werden und statt ihrer der Sprungbefehl eingefügt wird, die funktionale Integrität des Unterprogramms nicht gegeben ist. Da nach Beendigung des Ablaufverfolgungsprogramms alle vorgenommenen Veränderungen im Maschinencode wieder rückgängig gemacht werden müssen, also insbesondere die in dem Pufferspeicher befindlichen Instruktionen zurückgeschrieben werden müssen, ist auch für diesen Zeitraum die funktionale Integrität des Unterprogramms nicht gegeben. Eine derartige zeitweise Beschädigung der funktionalen Integrität kann jedoch zum Abbruch des Unterprogramms und auch des aufrufenden Programms führen. Außerdem kann durch das notwendige Hin- und Herschieben der verdrängten Instruktionen im Arbeitsspeicher das eigentliche Ablaufverhalten des Unterprogramms beeinträchtigt werden, wodurch die Aussagekraft der durch die Ablaufverfolgung gewonnenen Daten infrage gestellt ist. Ein weiterer Nachteil dieses Verfahrens liegt darin, dass im Falle einer beim Ablauf des Unterprogramms auftretenden Ausnahme, die nicht innerhalb des Unterprogramms behandelt werden kann, das Unterprogramm nicht regulär beendet wird, ohne dass diese Beendigung aufgezeichnet wird. Dadurch wird die eigentlich durch die Ablaufverfolgung bezweckte Fehleranalyse erschwert. Die Aufgabe der vorliegenden Erfindung ist es, eine verbesserte dynamisch aktivierbare Ablaufverfolgung eines auf einem Computersystem laufenden Unterprogramms zu ermöglichen.A disadvantage of this method, however, is that for the period in which the instructions to be displaced are written into the buffer memory and instead of the jump command is inserted, the functional integrity of the subroutine is not given. Since after completion of the trace program all changes made in the machine code must be reversed, ie in particular the instructions contained in the buffer memory must be written back, the functional integrity of the subroutine is not given for this period. However, such temporary damage to the functional integrity may lead to the abort of the subroutine and also of the calling program. In addition, the actual execution behavior of the subroutine can be impaired by the necessary switching back and forth of the displaced instructions in the main memory, whereby the significance of the data obtained by the trace is questioned. Another disadvantage of this method is that in the case of an exception occurring at the end of the subroutine, which is not within the scope of the invention Subroutine can not be handled, the subroutine will not shut down normally without this completion being recorded. This complicates the error analysis that is actually intended by the trace. The object of the present invention is to enable an improved dynamically activatable trace of a subroutine running on a computer system.

Diese Aufgabe wird durch den Gegenstand des Hauptanspruchs gelöst.This object is solved by the subject of the main claim.

Bevorzugte Ausgestaltungen der vorliegenden Erfindung sind Gegenstände der Unteransprüche.Preferred embodiments of the present invention are subject matters of the subclaims.

Der Erfindung geht von der Beobachtung aus, dass viele Unterprogramme Leeranweisungen, die aus einer Leerinstruktion oder einer Folge von Leerinstruktionen bestehen, beinhalten, die die eigentliche Funktion eines Unterprogramms nicht beeinflussen, aber aus anderen Gründen in das Unterprogramm eingefügt worden sind. Ein Grund für das Einfügen von Leeranweisungen liegt z. B. darin, den zeitlichen Ablauf eines Unterprogramms so zu beeinflussen, dass sichergestellt wird, dass bestimmte Zeitanforderungen an und durch das Unterprogramm, das Programm und/oder das Betriebssystem erfüllt werden. Das Einfügen von Leeranweisungen ist dabei eine gängige Maßnahme, da dadurch das Timing-Verhalten des Unterprogramms beeinflusst wird, nicht aber die von dem Unterprogramm verwalteten Register und Speicherwerte. Ein weiterer Grund für das Einfügen von Leeranweisungen liegt z. B. darin, den Maschinencode im Arbeitsspeicher so auszurichten, dass der spätere Zugriff optimiert wird. Zudem kann durch das Einfügen einer Leeranweisung das jeweilige Unterprogramm für eine spätere dynamische Aktualisierung vorzubereitet werden. So wird z. B. für Betriebssystemkomponenten, d. h. Unterprogrammen von Windows NT®, bei denen von Anfang an davon ausgegangen wird, dass sie später durch ein korrigiertes Unterprogramm, einen so genannten Patch, aktualisiert werden müssen, bereits bei der Programmierung am Anfang eines solchen Unterprogramms eine Leeranweisung eingefügt, die der Größe einer Sprunganweisung entspricht. Steht dann später ein Patch zur Verfügung, kann dieser in den Arbeitsspeicher geladen werden und der Programmkontrollfluss durch Überschreiben der Leeranweisung mit einer Sprunganweisung zu diesem Patch dynamisch umgelenkt werden (sog. „hot-patching”).The invention is based on the observation that many subroutines contain empty instructions consisting of an empty instruction or a sequence of empty instructions which do not affect the actual function of a subroutine but have been inserted into the subroutine for other reasons. One reason for inserting empty statements is z. Example, to influence the timing of a subroutine so that it is ensured that certain time requirements are met to and by the subroutine, the program and / or the operating system. The insertion of empty instructions is a common measure, as it affects the timing behavior of the subroutine, but not the registers and memory values managed by the subroutine. Another reason for inserting empty instructions is z. Example is to align the machine code in memory so that the subsequent access is optimized. In addition, by inserting an empty instruction, the respective subprogram can be prepared for later dynamic updating. So z. B. for operating system components, ie subroutines of Windows NT ® , which are assumed from the beginning that they must be updated later by a corrected subroutine, a so-called patch, already inserted in the programming at the beginning of such a subroutine an empty statement which corresponds to the size of a jump instruction. If a patch is available later, it can be loaded into the main memory and the program control flow can be dynamically redirected by overwriting the empty instruction with a jump instruction to this patch (so-called "hot-patching").

Der vorliegenden Erfindung liegt der Gedanke zugrunde, das Vorhandensein solcher Leeranweisungen im Code eines Unterprogramms zum Zwecke der Ablaufverfolgung auszunutzen. Dazu wird bei einem Unterprogramm, das sich in einem Arbeitsspeicher eines Computersystems in Maschinencode befindet und eine Leeranweisung beinhaltet, die aus einer Leerinstruktion oder einer Folge von Leerinstruktionen besteht, die Leeranweisung durch eine Sprunganweisung ersetzt, die bei Aufruf des Unterprogramms den Programmkontrollfluss zu einem Ablaufverfolgungsmodul umlenkt, das zuvor in den Arbeitsspeicher eingebracht worden ist. Das Ablaufverfolgungsmodul registriert den Eintritt in das Unterprogramm und gibt dann den Programmkontrollfluss an die Instruktion des Unterprogramms zurück, die der ersetzten Leeranweisung folgt.The present invention is based on the idea to exploit the presence of such empty statements in the code of a subroutine for the purpose of tracing. For this purpose, in a subroutine contained in a main memory of a computer system in machine code and containing an idle instruction consisting of a dummy instruction or a sequence of dummy instructions, the dummy instruction is replaced by a jump instruction which, upon invocation of the subroutine, redirects the program control flow to a trace module which has been previously placed in the main memory. The trace module registers entry to the subroutine and then returns the program control flow to the instruction of the subroutine following the replaced empty instruction.

Bevorzugterweise wird vor der Überschreibung der Leeranweisung sichergestellt, dass diese nicht Sprungziel einer in dem Unterprogramm enthaltenen Sprunganweisung ist. Dies wird im Allgemeinen nicht bei Unterprogrammen der Fall sein, die für die spätere dynamische Aktualisierung programmiert worden sind, kann aber durchaus der Fall sein, wenn die Leeranweisung aus Timing-Gründen eingefügt worden ist. Daher werden bevorzugterweise durch eine Management-Anwendung die im Arbeitsspeicher des Computersystems befindlichen Unterprogramme identifiziert, die eine Leeranweisung enthalten, die im Maschinencode eine Länge aufweist, die mindestens einer Länge des Maschinencodes einer Sprunganweisung entspricht und die nicht Ziel einer im Unterprogramm befindlichen Sprunganweisung ist. Die Management-Anwendungen kann solche Unterprogramme z. B. dadurch identifizieren, dass sie die im Arbeitsspeicher befindlichen Unterprogramme mit einer Liste von Unterprogrammen vergleicht, für die bekannt ist, dass sie eine geeignete Leeranweisung enthalten und auch an welcher Stelle sie diese enthalten. Die Management-Anwendung kann solche Unterprogramme z. B. aber auch dadurch identifizieren, indem sie deren im Arbeitsspeicher befindlichen Maschinencode analysiert. Befindet sich eine Leeranweisung mit ausreichender Länge nicht am Anfang sondern erst an späterer Stelle eines Unterprogramms, dürfen auch die vor der Leeranweisung vorkommenden Instruktionen nicht Ziel einer Sprunganweisung sein. In diesem Zusammenhang wird darauf hingewiesen, dass bei einem Unterprogramm, bei dem sich eine geeignete Leeranweisung am Anfang befindet, der Eintritt in dieses Unterprogramm exakt registriert werden kann, wohingegen dies bei einem Unterprogramm, bei dem sich eine geeignete Leeranweisung erst später im Code befindet, der Eintritt in das Unterprogramm verzögert registriert wird. Trotzdem können die dadurch gewonnen Informationen wertvolle Dienste bei der Fehleranalyse leisten.Preferably, before overwriting the dummy instruction, it is ensured that it is not a jump target of a jump instruction contained in the subroutine. This will generally not be the case with subroutines that have been programmed for the later dynamic update, but may well be the case if the dummy instruction has been inserted for timing reasons. Therefore, preferably, a management application identifies the subprograms residing in the main memory of the computer system which contain an idle instruction having a length in the machine code which corresponds to at least a length of the machine code of a jar instruction and which is not the target of a jar instruction located in the subroutine. The management applications can such subroutines z. B. by comparing the in-memory subroutines with a list of subroutines that are known to contain a suitable empty statement and also where they contain them. The management application can such subroutines z. B. but also by analyzing their memory in machine memory code. If an empty instruction of sufficient length is not at the beginning but rather at a later point in a subprogram, then the instructions occurring before the empty instruction must not be the target of a jump instruction. In this regard, it should be noted that in a subroutine having a suitable empty instruction at the beginning, entry into this subroutine can be accurately registered, whereas in a subroutine where a suitable empty instruction is later in the code, the entry into the subroutine is delayed registered. Nevertheless, the information gained thereby can provide valuable services in fault analysis.

Gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung wird der Maschinencode eines bereits im Arbeitsspeicher befindlichen Unterprogramms zur Laufzeit des zugehörigen Programms durch Ersetzen einer im Unterprogramm befindlichen Leeranweisung durch eine Sprunganweisung, die direkt oder indirekt auf ein Ablaufverfolgungsmodul verweist, das sich ebenfalls im Maschinencode im Arbeitsspeicher befindet, für eine dynamische Ablaufverfolgung durch das Ablaufverfolgungsmodul instrumentiert. Das Ablaufverfolgungsmodul registriert einen Eintritt in das Unterprogramm und manipuliert den dem Unterprogramm zugeordneten Eintrag in einem Aufrufstapel derart, dass die zugehörige Rücksprungadresse durch eine Adresse einer vom Ablaufverfolgungsmodul bereitgestellten Austrittsroutine ersetzt wird. Zudem wird ein Hilfsstapelspeicher generiert, der die vom Aufrufstapelspeicher verdrängte ursprüngliche Rücksprungadresse aufnimmt und von der Austrittsroutine nach deren Beendigung zum korrekten Rücksprung in das das Unterprogramm aufrufende Programm ermöglicht.According to a preferred embodiment of the present invention, the machine code of an already in-memory subroutine at runtime of the associated program by replacing a subroutine in the empty instruction by a jump instruction that refers directly or indirectly to a trace module, which is also in the machine code in Memory is instrumented for a dynamic trace by the trace engine. The trace module registers entry into the subroutine and manipulates the entry associated with the subroutine in a call stack such that the associated return address is replaced with an address of an exit routine provided by the trace module. In addition, an auxiliary stack is generated, which receives the displaced from the call stack memory original return address and allows the exit routine after the completion of the correct return to the program calling the subroutine.

In einer bevorzugten Ausführungsform der vorliegenden Erfindung wird durch das Ablaufverfolgungsmodul nicht nur der Eintritt in ein Unterprogramm registriert, sondern auch der Austritt aus diesem. Dazu wird die bei Aufruf des Unterprogramms in einem Aufrufstapel abgelegte Rücksprungadresse durch eine Adresse ersetzt, die ein Umlenken des Programmkontrollflusses zu einer Austrittsroutine des Ablaufverfolgungsmoduls ermöglicht. Dadurch wird nach Abarbeitung der in dem Unterprogramm befindlichen Instruktionen der Programmkontrollfluss zu der Austrittsroutine umgelenkt, die den Austritt aus dem Unterprogramm registriert und anschließend den Programmkontrollfluss an die in einem Hilfsstapel gespeicherte ursprüngliche Rücksprungadresse weiterleitet.In a preferred embodiment of the present invention, not only the entry into a subroutine is registered by the trace module, but also the exit from it. For this purpose, the return address stored in a call stack when the subprogram is called up is replaced by an address which allows the program control flow to be redirected to an exit routine of the trace module. As a result, after execution of the instructions located in the subroutine, the program control flow is diverted to the exit routine, which registers the exit from the subroutine and then forwards the program control flow to the original return address stored in an auxiliary stack.

In einer bevorzugten Ausführungsform der vorliegenden Erfindung berücksichtigt das Ablaufverfolgungsmodul auch das Auftreten von Ausnahmen sowie deren Behandlung. Dazu wird bei Aufruf eines Unterprogramms eine von dem Ablaufverfolgungsmodul bereitgestellte Ausnahmebehandlungsfunktion registriert. Registrieren bedeutet in diesem Zusammenhang, dass eine Information bezüglich der Ausnahmebehandlungsfunktion an einer bekannten Stelle abgelegt wird. Wird durch eine aufgetretene Ausnahme eine nicht-reguläre Beendigung des Unterprogramms notwendig, wird dies durch die Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls registriert.In a preferred embodiment of the present invention, the trace module also takes into account the occurrence of exceptions and their treatment. For this purpose, when a subroutine is called, an exception handling function provided by the trace module is registered. Register means in this context that information regarding the exception handling function is stored in a known location. If a non-regular termination of the subroutine is necessary due to an exception that has occurred, this is registered by the exception handling function of the trace module.

Bevorzugterweise wird dazu eine in einem obersten Eintrag in einer Ausnahmebehandlungsregistrierungskette, die Adressen bzw. Zeiger zu im Zusammenhang mit aufgerufenen Unterprogrammen registrierten Ausnahmebehandlungsfunktionen enthält, gespeicherte Adresse durch die Adresse der von dem Ablaufverfolgungsmodul bereitgestellten Ausnahmebehandlungsfunktion ersetzt und stattdessen in einem Hilfsstapel gespeichert. Bei Auftreten einer Ausnahme wird die Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls mittels der im Eintrag der Ausnahmebehandlungsregistrierungskette gespeicherten Adresse aufgerufen, die wiederum die ursprünglich registrierte Ausnahmebehandlungsfunktion mittels der in dem Hilfsstapel gespeicherten Adresse aufruft. Die Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls sorgt dabei dafür, dass bei einer durch die aufgetretene Ausnahme verursachten Abwicklung des Aufrufstapels keine nicht mehr benötigten Einträge in dem Hilfsstapel bestehen bleiben.Preferably, for this purpose, a stored address in a top entry in an exception handler registration chain containing addresses or pointers to exception handling functions registered in connection with called subroutines is replaced with the address of the exception handler provided by the trace module and stored instead in an auxiliary stack. When an exception occurs, the exception handling function of the trace module is called by the address stored in the exception handler registration chain entry, which in turn calls the originally registered exception handler function using the address stored in the helper stack. The exception handling function of the trace module ensures that in the case of a handling of the call stack caused by the exception that has occurred, no entries no longer required remain in the auxiliary stack.

Bevorzugterweise veranlasst die Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls nach ihrem Aufruf eine vorübergehende Registrierung einer weiteren Ausnahmebehandlungsfunktion, die als Aufräum- und Protokollfunktion fungiert. Wird durch die aufgetretene Ausnahme eine Abwicklung des Aufrufstapels verursacht, wird auf diese weitere Ausnahmebehandlungsfunktion zugegriffen, die die Abwicklung des Hilfsstapels vornimmt und gegebenenfalls registriert.Preferably, the exception handler function of the trace module, after being called, causes a temporary registration of another exception handler that acts as a cleanup and logger. If the occurrence of the exception causes the call stack to be processed, this additional exception handling function is accessed, which carries out the handling of the auxiliary stack and, if necessary, registers it.

Weitere Vorteile sowie bevorzugte Ausführungsformen der vorliegenden Erfindung ergeben sich im Folgenden unter Bezugnahme auf die beiliegenden Zeichnungen. Die Zeichnungen sowie die nachfolgende detaillierte Beschreibung sind nicht dazu gedacht, den Schutzbereich der in den Patentansprüchen definierten Erfindung zu begrenzen, sondern das Verständnis der Merkmale und Vorteile der Erfindung zu erleichtern.Further advantages and preferred embodiments of the present invention will become apparent hereinafter with reference to the accompanying drawings. The drawings as well as the following detailed description are not intended to limit the scope of the invention defined in the claims but to facilitate an understanding of the features and advantages of the invention.

Dabei zeigen die Zeichnungen im Einzelnen:The drawings show in detail:

1 eine schematische Darstellung einer Erzeugung von Maschinencode aus einem Quellcode eines Programms; 1 a schematic representation of a generation of machine code from a source code of a program;

2a eine schematische Darstellung eines Programmkontrollflusses zwischen einem Programm und zwei Unterprogrammen gemäß dem Stand der Technik; 2a a schematic representation of a program control flow between a program and two subroutines according to the prior art;

2b eine schematische Darstellung des Inhalts eines Aufrufstapelspeichers während des in 2a dargestellten Programmkontrollflusses gemäß dem Stand der Technik; 2 B a schematic representation of the contents of a call stack storage during the in 2a illustrated program control flow according to the prior art;

3a eine schematische Darstellung eines Unterprogramms und eines Aufrufstapelspeichers zur Laufzeit gemäß dem Stand der Technik; 3a a schematic representation of a subroutine and a call stack storage at runtime according to the prior art;

3b eine schematische Darstellung eines Unterprogramms, eines Ablaufverfolgungsmoduls, eines Aufrufstapelspeichers und eines Hilfsstapelspeichers zur Laufzeit gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 3b a schematic representation of a subroutine, a trace module, a call stack and an auxiliary stack at run time according to a preferred embodiment of the present invention;

4a eine schematische Darstellung eines Programmkontrollflusses zwischen einem Programm, zwei Unterprogrammen sowie einem Ablaufverfolgungsmodul gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 4a a schematic representation of a program control flow between a program, two subroutines and a Trace module according to a preferred embodiment of the present invention;

4b eine schematische Darstellung des Inhalts eines Aufrufstapelspeichers während des in 4a dargestellten Programmkontrollflusses gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 4b a schematic representation of the contents of a call stack storage during the in 4a illustrated program control flow according to a preferred embodiment of the present invention;

5 eine schematische Darstellung einer Ausnahmebehandlung gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 5 a schematic representation of an exception treatment according to a preferred embodiment of the present invention;

6 eine schematische Darstellung einer Registrierung einer Ausnahmebehandlungsfunktion eines Ablaufverfolgungsmoduls gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 6 a schematic representation of a registration of an exception handling function of a trace module according to a preferred embodiment of the present invention;

7 eine schematische Darstellung einer Ausnahmebehandlung unter Nutzung eines Abwicklungsflags gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 7 a schematic representation of an exception treatment using a transaction flag according to a preferred embodiment of the present invention;

8 eine schematische Darstellung eines Ablaufverfolgungsmoduls gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; 8th a schematic representation of a trace module according to a preferred embodiment of the present invention;

9 eine schematische Darstellung eines Ablaufverfolgung im Nutzer-Modus gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung; und 9 a schematic representation of a trace in the user mode according to a preferred embodiment of the present invention; and

10 eine schematische Darstellung eines Ablaufverfolgung im Betriebssystemkern-Modus gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung. 10 a schematic representation of a trace in operating system kernel mode according to a preferred embodiment of the present invention.

1 stellt schematisch dar, wie aus dem Quellcode eines Programms Maschinencode erzeugt wird. Programme werden von einem Programmierer üblicherweise in einer höheren Programmiersprache geschrieben, z. B. Fortran, C, C++ oder Java, die dem Programmierer eine verständliche und prozessorarchitekturunabhängige Programmierung erlauben. Um ein in einer Hochsprache vorliegendes Programm auf einem bestimmten Rechner ablaufen lassen zu können, ist eine Übersetzung dieses Programms in eine Maschinensprache notwendig, die der Prozessorarchitektur, d. h. unter anderem dem Maschinenbefehlssatz und den Adressierungsmodi des zugrundeliegenden Mikroprozessors entspricht. 1 schematically illustrates how machine code is generated from the source code of a program. Programs are typically written by a programmer in a high level language, e.g. Fortran, C, C ++ or Java, which allow the programmer to understand and processor architecture-independent programming. In order to run a high-level language program on a particular computer, it is necessary to translate that program into a machine language corresponding to the processor architecture, ie, the machine instruction set and the addressing modes of the underlying microprocessor, among other things.

1 zeigt den Quellcode 100 eines Programms. Der Quellcode besteht üblicherweise aus einem Hauptprogrammteil 102 und verschiedenen Unterprogrammteilen 104, 106 und 108. Ein Compiler 120 übersetzt die verschiedenen Programmteile des Quellcode in verschiedene Objektcodemodule 142, 144, 146 und 148, wobei der Objektcode der Maschinensprache des zugrundeliegenden Mikroprozessors entspricht. Ein Binder 160, auch Linker genannt, verbindet die verschiedenen Objektcodemodule 142, 144, 146 und 148 und eventuell benötigte weitere Bibliotheksmodule aus einer Bibliothek 170 derart, dass ein von dem Mikroprozessor ausführbares Maschinenprogramm 180 in Maschinencode entsteht. Der Maschinencode des Maschinenprogramms 180 stellt dabei eine zusammenhänge Binärfolge dar, die in den Arbeitsspeicher des Computersystems geladen wird. Dementsprechend befindet sich der Maschinencode 180 zur Laufzeit des Programms in dem Arbeitsspeicher des Computersystems und wird von dem Prozessor des Computersystems entsprechend der vorliegenden Binärfolge abgearbeitet. 1 shows the source code 100 a program. The source code usually consists of a main program part 102 and various subroutine parts 104 . 106 and 108 , A compiler 120 translates the various program parts of the source code into different object code modules 142 . 144 . 146 and 148 , wherein the object code corresponds to the machine language of the underlying microprocessor. A binder 160 , also called linker, connects the various object code modules 142 . 144 . 146 and 148 and possibly needed additional library modules from a library 170 such that a machine program executable by the microprocessor 180 created in machine code. The machine code of the machine program 180 represents a related binary sequence, which is loaded into the memory of the computer system. Accordingly, the machine code is located 180 at runtime of the program in the main memory of the computer system and is processed by the processor of the computer system according to the present binary sequence.

Die Binärfolge des Maschinencodes 180 entspricht einer Sequenz von direkt vom Prozessor ausführbaren Instruktionen, die von dem Prozessor nacheinander abgearbeitet werden. Allerdings kann durch Sprunginstruktionen der Programmkontrollfluss zwischen verschiedenen Teilen des Maschinencodes 180 hin- und hergelenkt werden. Zudem enthält das Maschinenprogramm 180 mehrere Sequenzen von Instruktionen, die einem Hauptprogramm 182 und mehreren Unterprogrammen 184 entsprechen. Dabei kann ein Unterprogramm aus dem Hauptprogramm oder einem anderen Unterprogramm heraus aufgerufen werden. Zudem enthält das Maschinenprogramm 180 weitere Informationen 186, die von dem Hauptprogramm und/oder den Unterprogrammen beim Auftreten von Ausnahmen während des Programmablaufs benötigt werden.The binary sequence of the machine code 180 corresponds to a sequence of instructions executable directly by the processor, which are executed by the processor one after the other. However, by jump instructions the program control flow can be between different parts of the machine code 180 be turned back and forth. In addition, the machine program contains 180 several sequences of instructions that are a main program 182 and several subroutines 184 correspond. A subprogram can be called from the main program or another subroutine. In addition, the machine program contains 180 additional Information 186 which are required by the main program and / or subroutines when exceptions occur during program execution.

2a zeigt einen beispielhaften Programmkontrollfluss zwischen einem Hauptprogramm HP 200 und zwei Unterprogrammen UPX 220 und UPY 240. Der Prozessor arbeitet zunächst alle Instruktionen des Hauptprogramms HP 200 nacheinander ab. Durch eine Aufrufinstruktion 202 zu dem Unterprogramm UPX 220 wird der Programmkontrollfluss zu der ersten Instruktion 222 des Unterprogramms UPX 220 umgelenkt (S1). Die Instruktionen des Unterprogramms UPX 220 werden nacheinander abgearbeitet bis eine Aufrufinstruktion 224 den Programmkontrollfluss zu der ersten Instruktion 242 des Unterprogramms UPY 240 umlenkt (S2). Die Instruktionen des Unterprogramms UPY 240 werden nacheinander abgearbeitet. Am Ende 248 des Unterprogramms UPY 240 wird ein Rücksprung S3 zum aufrufenden Unterprogramm UPX 220 veranlasst. Dabei wird zu der Instruktion 226 des Unterprogramms UPX 220 zurückgesprungen, die der Aufrufinstruktion 224 folgt. Die weiteren Instruktionen des Unterprogramms UPX 220 werden dann nacheinander abgearbeitet. Am Ende 228 des Unterprogramms UPX 220 wird ein Rücksprung S4 zu der Instruktion 204 des Hauptprogramms HP 200 veranlasst, der der Aufrufinstruktion 202 folgt. Anschließend werden die weiteren Instruktionen des Hauptprogramms HP 200 nacheinander abgearbeitet. 2a shows an exemplary program control flow between a main program HP 200 and two subprograms UPX 220 and UPY 240 , The processor works at first all Instructions of the main program HP 200 one after the other. By a call instruction 202 to the subroutine UPX 220 the program control flow becomes the first instruction 222 subprogram UPX 220 redirected (S1). The instructions of subroutine UPX 220 are processed consecutively until a call instruction 224 the program control flow to the first instruction 242 of the subroutine UPY 240 redirects (S2). The instructions of subroutine UPY 240 are processed one after the other. At the end 248 of the subroutine UPY 240 a return S3 to the calling subprogram UPX 220 causes. At the same time the instruction becomes 226 subprogram UPX 220 jumped back, the call instruction 224 follows. The further instructions of subroutine UPX 220 are then processed sequentially. At the end 228 subprogram UPX 220 a return S4 to the instruction 204 of the main program HP 200 causes the call instruction 202 follows. Subsequently, the further instructions of the main program HP 200 processed one after the other.

Um einem aufgerufenen Unterprogramm einen Rücksprung zu dem aufrufenden Programm zu ermöglichen, wird üblicherweise ein Aufrufstapel verwendet. Ein Aufrufstapel stellt eine dynamische Datenstruktur dar, die Information über aktive Unterprogramme eines laufenden Computerprogramms speichert. Wird ein Unterprogramm aufgerufen, wird eine geeignete Rücksprungadresse auf den Aufrufstapel gelegt. Nach Beendigung des Unterprogramms wird die Rücksprungadresse wieder von dem Aufrufstapel entfernt und für einen Rücksprung verwendet. 2b zeigt am Beispiel der in 2a dargestellten Programmkontrollflusssegmente, wie sich der Aufrufstapel während des Ablaufs eines Computerprogramms verändert.In order to allow a called subroutine to return to the calling program, a call stack is usually used. A call stack represents a dynamic data structure that stores information about active subroutines of a running computer program. If a subprogram is called, a suitable return address is placed on the call stack. Upon completion of the subroutine, the return address is again removed from the call stack and used for a return. 2 B shows the example of in 2a program control flow segments shown how the call stack changes during the course of a computer program.

Segment 200A des in 2a dargestellten Programmkontrollflusses der 2a erstreckt sich bis zu der Aufrufinstruktion 202 des Hauptprogrammteils HP 200. Es sind keine Unterprogramme aktiv. Der Aufrufstapelspeicher 280 ist daher frei von Einträgen, die sich auf Unterprogrammaufrufe beziehen. Durch den Aufruf 202 wird eine Umlenkung S1 des Kontrollflusses zur Instruktion 222 des Unterprogramms UPX 220 veranlasst. Die Adresse der auf den Aufruf 202 folgenden Instruktion 204 im Hauptprogramm HP 200 wird in den Aufrufstapelspeicher 280 gelegt. In Segment 200B des Programmkontrollflusses, das die Instruktionen 222 bis 224 beinhaltet, befindet sich daher in dem Aufrufstapelspeicher 280 der Eintrag 282, der die Rücksprungadresse RSA_HP zur Instruktion 204 des Hauptprogramms HP 200 enthält. Durch den Aufruf 224 wird das Unterprogramm UPY 240 aus dem Unterprogramm UPX 220 aufgerufen. Der Programmkontrollfluss wird durch die Umlenkung S2 zur Instruktion 242 des Unterprogramms UPY 240 umgelenkt und die Adresse der auf den Aufruf 224 folgenden Instruktion 226 des Unterprogramms UPY 240 in den Aufrufstapelspeicher 280 in einem neuen Eintrag 284 gelegt. In Segment 200C des Programmkontrollflusses, das die Instruktionen des Unterprogramms UPY 240 umfasst, befindet sich daher in dem Aufrufstapelspeicher 220 ein Eintrag 282 mit der vorher darin abgelegten Rücksprungadresse RSA_HP zum Hauptprogramm HP 200 und darauf ein neuer Eintrag 284 mit der neu abgelegten Rücksprungadresse RSA_UPX zum Unterprogramm UPX 220. Am Ende des Unterprogramms UPY 240 wird ein Rücksprung S3 zu der Adresse veranlasst, die in dem gegenwärtig obersten Eintrag des Aufrufstapelspeichers 280 abgelegt ist, also zur in Eintrag 284 abgelegten Adresse RSA_UPX, und der oberste Eintrag 284 von dem Aufrufstapelspeicher entfernt. In Segment 200D des Programmkontrollflusses, das die Instruktionen 226 bis 228 des Unterprogramms UPX 220 umfasst, befindet sich daher nur noch der Eintrag 282 in dem Aufrufstapelspeicher 280. Nach Beendigung des Unterprogramms UPX wird ebenfalls ein Rücksprung zu der Adresse veranlasst, die in dem gegenwärtig obersten Eintrag des Aufrufstapelspeichers 280 abgelegt ist, also der in Eintrag 282 abgelegten Rücksprungadresse RSA_HP zur Instruktion 204 des HP 200. Der Rücksprung S4 zur Instruktion 204 des Hauptprogramms HP 200 wird durchgeführt und der Eintrag 282 aus dem Aufrufstapelspeicher 280 entfernt. Somit beinhaltet der Aufrufstapelspeicher 280 in Segment 200E des Programmkontrollflusses, das mit Instruktion 204 des Hauptprogramms HP 200 beginnt, keine Einträge mehr, die sich auf aktive Unterprogramme beziehen.segment 200A of in 2a shown program control flow of 2a extends to the call instruction 202 of the main program part HP 200 , There are no subroutines active. The call stack 280 is therefore free from entries related to subroutine calls. By the call 202 becomes a redirection S1 of the control flow to the instruction 222 subprogram UPX 220 causes. The address of the call 202 following instruction 204 in the main program HP 200 gets into the call stack 280 placed. In segment 200B the program control flow containing the instructions 222 to 224 Therefore, it is located in the call stack 280 the entry 282 which returns the return address RSA_HP for instruction 204 of the main program HP 200 contains. By the call 224 becomes the subroutine UPY 240 from the subroutine UPX 220 called. The program control flow is the instruction S2 through the reversal S2 242 of the subroutine UPY 240 redirected and the address of the call 224 following instruction 226 of the subroutine UPY 240 into the call stack 280 in a new entry 284 placed. In segment 200C the program control flow containing the instructions of the subroutine UPY 240 Therefore, it is located in the call stack 220 An entry 282 with the previously stored therein return address RSA_HP to the main program HP 200 and then a new entry 284 with the newly stored return address RSA_UPX to the subprogram UPX 220 , At the end of the subroutine UPY 240 a return S3 is made to the address in the currently highest entry of the call stack 280 is stored, so in the entry 284 stored address RSA_UPX, and the top entry 284 removed from the call stack. In segment 200D the program control flow containing the instructions 226 to 228 subprogram UPX 220 Therefore, there is only the entry 282 in the call stack 280 , Upon completion of subroutine UPX, a return is also made to the address in the currently top entry of the call stack 280 is stored, so in the entry 282 stored return address RSA_HP for instruction 204 of the HP 200 , The return S4 to the instruction 204 of the main program HP 200 is done and the entry 282 from the call stack 280 away. Thus, the call stack includes memory 280 in segment 200E the program control flow, that with instruction 204 of the main program HP 200 starts, no entries related to active subprograms.

An dieser Stelle wird angemerkt, dass 2b vereinfachte Darstellungen eines Aufrufstapelspeichers enthält. So kann ein einem aktiven Unterprogramm zugeordneter Eintrag im Aufrufstapelspeicher nicht nur die Rücksprungadresse zu dem jeweiligen aufrufenden Programm enthalten, sondern auch andere Informationen wie z. B. vom aufrufenden Programm übergebene Parameterwerte oder auch Informationen zur Ausnahmebehandlung. Ein einem Unterprogramm zugeordneter Eintrag in einem Aufrufstapelspeicher wird daher auch als Aufrufrahmen dieses Unterprogramms bezeichnet. Zudem kann der Aufrufstapelspeicher bereits bei Start des Hauptprogramms dynamisch erzeugt werden und auch Informationen für das Hauptprogramm z. B. bezüglich einer grundlegenden Ausnahmebehandlung beinhalten.At this point it is noted that 2 B contains simplified representations of a call stack. Thus, an entry associated with an active subroutine in the call stack may not only contain the return address to the particular calling program, but may also contain other information such as: For example, parameter values passed by the calling program or information about exception handling. An entry in a call stack associated with a subroutine is therefore also referred to as the call frame of this subroutine. In addition, the call stack memory can be generated dynamically at the start of the main program and also information for the main program z. With respect to basic exception handling.

3a zeigt schematisch ein Unterprogramm UPX 300 und einen Aufrufstapelspeicher 330 zur Laufzeit eines Programms, das das Unterprogramm UPX beinhaltet. 3a schematically shows a subroutine UPX 300 and a call stack 330 at runtime of a program containing the subprogram UPX.

In dem Aufrufstapelspeicher 330 befinden sich bereits mehrere Einträge 332, 334 und 336. Der unterste Eintrag 332 beinhaltet eine Rücksprungadresse RSA_HP zum Hauptprogramm und wurde im Zusammenhang mit dem ältesten aktiven Unterprogramm abgelegt. Eintrag 336 beinhaltet die Rücksprungadresse RSA_UPX-1 zu einem Unterprogramm UPX-1, aus dem heraus das Unterprogramm UPX 300 aufgerufen wurde, und wurde im Zusammenhang mit dem Aufruf des Unterprogramms UPX 300 abgelegt. Das Unterprogramm UPX 300 stellt das jüngste aktive Unterprogramm dar. Ein Unterprogramm wird dabei dann als aktiv bezeichnet, wenn es zwar aufgerufen, aber noch nicht beendet worden ist.In the call stack 330 There are already several entries 332 . 334 and 336 , The lowest entry 332 contains a return address RSA_HP to the main program and was stored in connection with the oldest active subroutine. entry 336 includes the return address RSA_UPX-1 to a subroutine UPX-1, from which the subroutine UPX 300 was called, and was associated with the call of the subprogram UPX 300 stored. The subprogram UPX 300 represents the most recent active subroutine. A subroutine is called active if it has been called but has not yet ended.

Das Unterprogramm UPX 300 der 3a wurde von dem Unterprogramm UPX-1 aufgerufen, weshalb der zugehörige Aufrufstapeleintrag 336 die Rücksprungadresse RSA_UPX-1 enthält. Zwischen dem obersten Eintrag 336, der dem jüngsten aktiven Unterprogramm entspricht und dem untersten Eintrag 332, der dem ältesten aktiven Unterprogramm entspricht, können noch weitere Einträge 334 liegen, die weiteren noch aktiven Unterprogrammen entsprechen. Dem Fachmann ist bekannt, dass sich zwei verschiedene Einträge auf dem Aufrufstapel durchaus auf dasselbe Unterprogramm des Maschinenprogramms 180 beziehen können, welches zu verschiedenen Zeitpunkten zur Laufzeit des Maschinenprogramms aufgerufen worden ist und daher unterschiedlichen Laufzeit-Unterprogrammen UPX, UPY, ... entspricht.The subprogram UPX 300 of the 3a was called by subroutine UPX-1, which is why the associated call batch entry 336 contains the return address RSA_UPX-1. Between the top entry 336 , which corresponds to the most recent active subroutine and the lowest entry 332 , which corresponds to the oldest active subroutine, can have additional entries 334 which correspond to further active subroutines. It is known to the person skilled in the art that two different entries on the call stack are quite similar to the same subroutine of the machine program 180 which has been called at different times at runtime of the machine program and therefore different runtime subprograms UPX, UPY, ... corresponds.

Das Unterprogramm UPX 300 bezeichnet in 3a das jüngste aktive, d. h. zuletzt aufgerufene und noch nicht beendete Unterprogramm. Sobald die Instruktionen des Unterprogramms UPX 300 abgearbeitet worden sind, kehrt der Programmkontrollfluss zu der im Aufrufstapel abgelegten Adresse RSA_UPX-1 des Unterprogramms UPX-1 zurück, das das Unterprogramm UPX 300 aufgerufen hat. Der dem Unterprogramm UPX 300 zugeordnete Eintrag 336 des Aufrufstapelspeichers 330 wird dabei vom Aufrufstapel entfernt, wie bereits im Zusammenhang mit den 2a und 2b näher beschrieben wurde.The subprogram UPX 300 designated in 3a the most recent active, ie last called and not finished subroutine. As soon as the instructions of the subprogram UPX 300 The program control flow returns to the address RSA_UPX-1 of subprogram UPX-1 stored in the call stack, which contains the subroutine UPX 300 has called. The subprogram UPX 300 associated entry 336 the call stack 330 is removed from the call stack, as already in connection with the 2a and 2 B was described in more detail.

Die ersten Instruktionen 302 bis 304 des Unterprogramms UPX 300 stellen eine Leeranweisung 310 dar. Durch die Instruktionen 302 bis 304 wird dabei illustriert, dass die Leeranweisung entweder die aus einer Instruktion 302 oder mehreren Instruktionen 302 bis 304 bestehen kann. In ersterem Fall würde somit die Leeranweisung 310 der ersten Instruktion 302 entsprechen und die Instruktion 304 wegfallen. Leeranweisungen entsprechen Instruktionen, die bei ihrer Ausführung keine Prozessorregister oder Speicherwerte ändern und somit keinen Einfluss auf die durch das Unterprogramm UPX 300 zur Verfügung gestellte Funktionalität besitzen. Allerdings verbrauchen sie eine bestimmte Anzahl von Prozessorzyklen zu ihrer Bearbeitung, weshalb sie oft aus Timing-Gründen eingesetzt werden. Zudem können sie aus Speicherausrichtungsgründen eingefügt sein oder als Platzhalter für eine spätere Sprunganweisung zu einem Patch dienen, falls dies bereits während der Programmierung des Unterprogramms UPX 300 vorgesehen wurde. Die genaue Ausgestaltung einer solchen Leeranweisung hängt vom Befehlssatz der jeweiligen zugrundeliegenden Prozessorarchitektur ab. Eine Leeranweisung kann als Leerinstruktion bereits in einem Befehlssatz vorgesehen sein, durch einen anderen Befehl mittels geeigneter Wahl dessen Operanden simuliert werden oder durch eine geeignete Verkettung von Befehlen, die in Summe einer leeren Anweisung entsprechen, implementiert werden. Im Falle des Betriebssystems Windows NT in der Version für die Intel x86-Architektur (32 Bit, IA-32) befindet sich z. B. bei Unterprogrammen, die für ein späteres Hot-Patching vorgesehen sind, zumeist am Anfang eine Instruktion „MOV edi, edi”, die eine Leerinstruktion darstellt und im Falle von Hot-Patching durch eine Kurzsprunganweisung („jump short”, umfasst im Falle von IA-32 2 Byte) ersetzt werden kann; beide Befehle weisen die gleiche Speichergröße auf. Die Kurzsprunganweisung lenkt dabei den Kontrollfluss nicht direkt auf das korrigierte Unterprogramm, sondern mittels einer in einem für Hot-Patching vorgesehenen Unterprogramm vorangehenden Puffer-Platz platzierten Langsprunganweisung („jump near”, umfasst im Falle von IA-32 5 Byte). Da die Langsprunganweisung unmittelbar dem Unterprogramm voransteht, wird die Adresse der ersten Instruktion des Unterprogramms auf den Aufrufstapel gelegt, woraus sich die Adresse der zweiten Instruktion des Unterprogramms und damit die Rücksprungadresse einfach ableiten lässt.The first instructions 302 to 304 subprogram UPX 300 make an idle statement 310 through the instructions 302 to 304 It is illustrated that the empty instruction is either that from an instruction 302 or several instructions 302 to 304 can exist. In the former case would thus be the empty instruction 310 the first instruction 302 correspond and the instruction 304 eliminated. Empty instructions correspond to instructions which, when executed, do not change any processor registers or memory values and thus have no influence on the instructions provided by the UPX subprogram 300 have provided functionality. However, they consume a certain number of processor cycles for their processing, which is why they are often used for timing reasons. In addition, they may be included for memory alignment purposes or may serve as placeholders for a later jump instruction to a patch, if already during the programming of the UPX subprogram 300 was provided. The exact configuration of such an empty instruction depends on the instruction set of the respective underlying processor architecture. An empty instruction can already be provided as an empty instruction in one instruction set, be simulated by another instruction by means of a suitable choice of its operands, or be implemented by a suitable concatenation of instructions which correspond in total to an empty instruction. In the case of the operating system Windows NT in the version for the Intel x86 architecture (32 bit, IA-32) is z. For example, in subroutines that are provided for a later hot-patching, usually at the beginning of an instruction "MOV edi, edi", which represents an empty instruction and in the case of hot-patching by a short jump instruction ("in the case from IA-32 2 bytes) can be replaced; both commands have the same memory size. The short jump instruction does not direct the control flow directly to the corrected subprogram, but instead means "jump near", which in the case of IA-32 comprises 5 bytes, by means of a long jump instruction placed in a buffer program preceding the hot patching. Since the long jump instruction is immediately preceded by the subroutine, the address of the first instruction of the subroutine is placed on the call stack, from which the address of the second instruction of the subroutine and thus the return address can be easily derived.

3b zeigt schematisch, wie das Unterprogramm UPX 300 und der Aufrufstapelspeicher 330 gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung verändert werden, um eine Ablaufverfolgung des Unterprogramms UPX 300 zu ermöglichen. 3b schematically shows how the subroutine UPX 300 and the call stack 330 In accordance with a preferred embodiment of the present invention, a trace of subroutine UPX is changed 300 to enable.

Um den Programmablauf eines Unterprogramms zu verfolgen, welches bereits in einen Arbeitsspeicher eines laufenden Computersystems in Maschinencode geladen worden ist, wird eine Leeranweisung in dem Maschinencode des zu verfolgenden Unterprogramms durch eine Sprunganweisung ersetzt, die den Programmkontrollfluss bei Aufruf des Unterprogramms auf ein in den Arbeitsspeicher eingebrachtes Ablaufverfolgungsmodul umlenkt. Diese Umlenkung kann direkt erfolgen, indem das Ablaufverfolgungsmodul als Sprungziel der Sprunganweisung definiert wird, oder auch indirekt über eine weitere Anweisung, wie oben anhand der Kurzsprung/Langsprung-Kombination dargestellt. Aus Gründen einer einfachen Darstellung des Sachverhalts wird im Folgenden zumeist von einer Sprunganweisung gesprochen, die den Programmkontrollfluss umlenkt, ohne zwischen direkter und indirekter Umlenkung zu unterscheiden. Für den Fachmann ist jedoch klar, dass sowohl eine direkte als auch eine indirekte Umlenkung im Einklang mit der vorliegenden Erfindung ist.In order to track the program flow of a subroutine which has already been loaded into a working memory of a running computer system in machine code, an empty instruction in the machine code of the subroutine to be tracked is replaced by a jump instruction which, upon invocation of the subroutine, places the program control flow into a memory inserted into the main memory Trace module redirects. This redirection can be done directly by defining the trace module as the jump destination of the jump instruction, or indirectly via another instruction, as shown above with reference to the short jump / long jump combination. For the sake of a simple presentation of the facts, the following is usually referred to as a jump instruction which redirects the program control flow without distinguishing between direct and indirect diversion. However, it will be apparent to those skilled in the art that both direct and indirect deflection are in accordance with the present invention.

In 3b ist die Sprunganweisung JMP_AVM 325 gezeigt, die in dem Unterprogramm UPX 300 die aus den Instruktionen 302 bis 304 bestehende ursprüngliche Leeranweisung 310 verdrängt. Die Leeranweisung 310 und die Sprunganweisung 325 weisen in Maschinencode die gleiche Länge auf. Die Sprunganweisung 325 lenkt den Programmkontrollfluss zu einer Eintrittsroutine ER 360 um, die durch ein Ablaufverfolgungsmodul AVM 350 bereitgestellt wird, welches in den Arbeitsspeicher eines Computersystems eingebracht worden ist. Die Sprunganweisung kann dabei direkt auf die Eintrittsroutine ER 360 verweisen, wie in 3a dargestellt, oder aber auf ein Zentralmodul ZM 355 innerhalb des Ablaufverfolgungsmoduls AVM 350, das den Programmkontrollfluss zwischen Komponenten des Ablaufverfolgungsmoduls AVM 350 steuert.In 3b is the jump instruction JMP_AVM 325 shown in the subprogram UPX 300 the from the instructions 302 to 304 existing original empty instruction 310 repressed. The empty instruction 310 and the jump instruction 325 have the same length in machine code. The jump instruction 325 directs the program control flow to an entry routine ER 360 um, by a trace module AVM 350 is provided, which has been introduced into the main memory of a computer system. The jump instruction can be directly to the entry routine ER 360 refer as in 3a represented, or on a central module ZM 355 within the trace module AVM 350 that the Program control flow between components of the trace module AVM 350 controls.

Die Eintrittsroutine ER 360 registriert den Eintritt in das Unterprogramm UPX 300 und lenkt daraufhin den Programmkontrollfluss zu der Instruktion 312 des Unterprogramms UPX 300 um, die der Sprunganweisung JMP_AVM 325 und somit der verdrängten Leeranweisung 310 folgt. Der Eintritt kann dabei durch ein zeitliches Protokollieren bzw. Aufzeichnen, Hochzählen eines Zählers oder eine andere Maßnahme registriert werden, die eine Zuordnung zu dem jeweiligen Unterprogramm ermöglicht.The entry routine ER 360 registers the entry into subprogram UPX 300 and then directs the program control flow to the instruction 312 subprogram UPX 300 um, the jump statement JMP_AVM 325 and thus the displaced empty instruction 310 follows. In this case, the admission can be registered by chronologically logging or recording, incrementing a counter or another measure which allows an assignment to the respective subprogram.

Zudem sorgt das Ablaufverfolgungsmodul AVM 350 dafür, dass auch der Austritt aus dem Unterprogramm UPX 300 protokolliert werden kann. Dazu ersetzt das Ablaufverfolgungsmodul AVM 350 die in dem Aufrufstapelspeicher 330 gespeicherte Rücksprungadresse RSA_UPX-1 für das Unterprogramm UPX 300 im Eintrag 336 mit einer Adresse RSA_AR, die den Kontrollfluss nach Beendigung des Unterprogramms UPX 300 nicht zu dem das Unterprogramm UPX 300 aufrufenden Programm zurücklenkt, sondern zu einer von dem Ablaufverfolgungsmodul AVM 350 zur Verfügung gestellten Austrittsroutine AR 370. Die durch die Rücksprungadresse RSA_AR im Eintrag 336 des Aufrufstapelspeichers 330 verdrängte Rücksprungadresse RSA_UPX-1 wird in einem obersten Eintrag 394 in einem Hilfsstapelspeicher 390 abgelegt. Der Hilfsstapelspeicher kann weitere Einträge 392 enthalten, die sich auf weitere ablaufverfolgte, noch aktive Unterprogramme beziehen. Die Austrittsroutine AR 370 des Ablaufverfolgungsmoduls AVM 350 registriert den Austritt aus dem Unterprogramm UPX 300 und lenkt dann den Kontrollfluss zu der Adresse um, die im obersten Eintrag 394 des Hilfsstapelspeichers 390 abgelegt ist, also zu der Adresse RSA_UPX-1. Wie im Zusammenhang mit der Eintrittsroutine ER 360 beschrieben kann diese Adresse RSA_AR direkt auf die Austrittsroutine AR 370 verweisen oder auf ein Zentralmodul ZM 355 des Ablaufverfolgungsmoduls AVM 350. Der Austritt kann dabei durch ein zeitliches Protokollieren bzw. Aufzeichnen, Herunterzählen eines Zählers oder eine andere Maßnahme registriert werden, die eine Zuordnung zu dem jeweiligen Unterprogramm ermöglicht.In addition, the trace module AVM provides 350 for the fact that also the exit from the subprogram UPX 300 can be logged. To do this, the trace module replaces AVM 350 the ones in the call stack 330 stored return address RSA_UPX-1 for subprogram UPX 300 in the entry 336 with an address RSA_AR indicating the control flow after the completion of subroutine UPX 300 not to the subprogram UPX 300 but to one of the trace module AVM 350 provided exit routine AR 370 , The by the return address RSA_AR in the entry 336 the call stack 330 displaced return address RSA_UPX-1 is in a top entry 394 in a utility stack 390 stored. The auxiliary stack can contain additional entries 392 which refer to further run-off, still active subprograms. The exit routine AR 370 the trace module AVM 350 registers the exit from the subroutine UPX 300 and then redirects the control flow to the address in the top entry 394 the auxiliary stack 390 is stored, that is to the address RSA_UPX-1. As in connection with the entry routine ER 360 described this address RSA_AR directly to the exit routine AR 370 refer or to a central module ZM 355 the trace module AVM 350 , In this case, the exit can be registered by chronological logging or recording, counting down of a counter or another measure which allows an assignment to the respective subprogram.

An dieser Stelle wird allgemein angemerkt, dass sich die hier im Zusammenhang mit der vorliegenden Erfindung beschriebenen Techniken auch für eine Multithreading-Umgebung eignen. In einer solchen Umgebung ist es bevorzugt, dass nur eine einzige Leerinstruktion durch die Sprunginstruktion, die den Kontrollfluss zum Ablaufverfolgungsmodul umlenkt, verdrängt wird, um Probleme im Zusammenhang mit sogenannten „preempted threads” zu vermeiden. In diesem Fall wird bevorzugterweise die oben dargestellte Kurzsprung/Langsprung-Kombination verwendet, da die Länge einer einzigen Instruktion üblicherweise nicht ausreicht, um bis zu dem Ablaufverfolgungsmodul zu springen. In 3 hätte dies z. B. zur Folge, dass die Leeranweisung 310 nur die erste Instruktion 302 des Unterprogramms UPX 300 umfasst und durch die Sprunganweisung JMP_AVM 325 verdrängt wird, die allerdings nicht direkt, sondern indirekt auf die Eintrittsroutine ER 360 des Ablaufverfolgungsmoduls AVM 350 verweist.It should be noted at this point that the techniques described herein in connection with the present invention are also suitable for a multithreaded environment. In such an environment, it is preferred that only a single empty instruction be displaced by the jump instruction, which redirects the control flow to the trace module, in order to avoid problems associated with so-called "preempted threads". In this case, the short jump / long jump combination illustrated above is preferably used since the length of a single instruction is usually not sufficient to jump to the trace module. In 3 would this have z. B. result in that the empty instruction 310 only the first instruction 302 subprogram UPX 300 and by the jump instruction JMP_AVM 325 is displaced, but not directly, but indirectly on the entry routine ER 360 the trace module AVM 350 points.

In 4a wird schematisch ein Kontrollflussdiagramm dargestellt, welches beim Aufruf eines Unterprogramms UPX 420 aus einem Hauptprogramm HP 410 sowie einem Aufruf eines Unterprogramms UPY 430 aus dem Unterprogramm UPX 420 entsteht, wenn die Unterprogramme UPX und UPY gemäß der vorliegenden Erfindung ablaufverfolgt werden.In 4a a control flow diagram is shown schematically, which when calling a subroutine UPX 420 from a main program HP 410 and a call to a subroutine UPY 430 from the subroutine UPX 420 occurs when subroutines UPX and UPY are executed in accordance with the present invention.

4b illustriert die Zustände des Aufrufstapels und des Hilfsstapels für einzelne Segmente 400A bis 400H des Programmkontrollflusses gemäß 4a. 4b illustrates the states of the call stack and the help stack for individual segments 400A to 400H the program control flow according to 4a ,

Die Instruktionen 412 eines Hauptprogramms HP 410 werden nacheinander abgearbeitet. Es sind keine Unterprogramme aktiv, deshalb befinden sich im Aufrufstapelspeicher 480 keine Einträge zu aktiven Unterprogrammen (400A). In Instruktion 413 des Hauptprogramms HP 410 erfolgt ein Aufruf eines Unterprogramms UPX 420. Infolge dieses Aufrufes wird in den Aufrufstapelspeicher 480 ein Eintrag bzw. Rahmen 482 für das aufgerufene Unterprogramm UPX 420 erstellt (400B), indem sich als Rücksprungadresse RSA_HP die Adresse der auf den Aufruf 413 folgenden Instruktion 414 des Hauptprogramms HP 410 befindet, und zum Anfang 422 des Unterprogramms UPX 420 gesprungen (S1). Unterprogramm UPX 420 wurde mit dem vorhin in Zusammenhang mit 3b beschriebenen Mechanismus für die Ablaufverfolgung instrumentiert und beinhaltet daher als erste Instruktion 422 eine Sprunganweisung JMP_AVM zu einer von dem Ablaufverfolgungsmodul AVM 440 bereitgestellten Eintrittsroutine ER 450. Die Adresse der auf die Sprunganweisung 422 folgenden Instruktion RSA_UPX_423 des Unterprogramms UPX 420 wird dabei bevorzugterweise in einem Register gespeichert, kann aber auch auf dem Aufrufstapel des Aufrufstapelspeichers 480 gespeichert werden. Nach erfolgtem Sprung (S2) ersetzt die Eintrittsroutine ER 450 die Adresse RSA_HP in dem dem Unterprogramm UPX 420 zugeordneten Eintrag 482 des Aufrufstapelspeichers 480 durch eine Adresse RSA_AR, die auf den Anfang einer von dem Ablaufverfolgungsmodul AVM 440 bereitgestellten Austrittsroutine AR 460 verweist. Die Rücksprungadresse RSA_HP wird stattdessen in einem Eintrag 492 in einem Hilfsstapelspeicher 490 abgelegt (400C). Die Eintrittsroutine ER 450 liest die Adresse RSA_UPX_423 aus dem Register oder dem Aufrufstapel aus und entfernt in letzterem Fall die Adresse RSA_UPX_423 wieder von dem Aufrufstapel. Die Eintrittsroutine 450 registriert den Eintritt in das Unterprogramm UPX 420 und springt mit Hilfe der ausgelesenen Adresse RSA_UPX_423 zu Instruktion 423 des Unterprogramms UPX 420 (S3).The instructions 412 a major program HP 410 are processed one after the other. There are no subprograms active, therefore they are in the call stack 480 no entries for active subroutines ( 400A ). In instruction 413 of the main program HP 410 a call is made to a subroutine UPX 420 , As a result of this call is placed in the call stack 480 an entry or frame 482 for the called subroutine UPX 420 created ( 400B ) by calling the return address RSA_HP as the address of the call 413 following instruction 414 of the main program HP 410 is located, and to the beginning 422 subprogram UPX 420 jumped (S1). Subprogram UPX 420 was related to the earlier 3b instrumented for tracing and thus includes as a first instruction 422 a jump instruction JMP_AVM to one of the trace module AVM 440 provided entrance routine ER 450 , The address of the jump instruction 422 following instruction RSA_UPX_ 423 subprogram UPX 420 is preferably stored in a register, but may also be on the call stack of the call stack 480 get saved. After the jump (S2), the entry routine replaces ER 450 the address RSA_HP in the subroutine UPX 420 associated entry 482 the call stack 480 by an address RSA_AR, which is at the beginning of one of the trace module AVM 440 provided exit routine AR 460 points. The return address RSA_HP is instead in an entry 492 in a utility stack 490 filed ( 400C ). The entry routine ER 450 reads the address RSA_UPX_ 423 from the register or the call stack and in the latter case removes the address RSA_UPX_ 423 again from the call stack. The admission routine 450 registers the entry into subprogram UPX 420 and jumps with the help of the read address RSA_UPX_ 423 to instruction 423 subprogram UPX 420 (S3).

Daraufhin werden die Instruktionen 424 des Unterprogramms UPX 420 ausgeführt, bis in Instruktion 425 ein Unterprogramm UPY 430 aufgerufen wird. Die Adresse der dem Aufruf 425 folgenden Instruktion 426 des Unterprogramms UPY 430 wird im Aufrufstapelspeicher 480 in einem dem aufgerufenen Unterprogramm UPY 430 zugeordneten Eintrag bzw. Rahmen 484 als Rücksprungadresse RSA_UPX abgelegt (400D) und es wird zum Anfang 432 des Unterprogramms UPY 430 gesprungen (S4). Das Unterprogramm UPY wurde entsprechend dem im Zusammenhang mit der 3b beschriebenen Mechanismus für die Ablaufverfolgung instrumentiert. Deshalb befindet sich am Beginn 432 des Unterprogramms UPY 430 eine Sprunganweisung zur Eintrittsroutine ER 450 des Ablaufverfolgungsmoduls AVM 440. Die der Sprunganweisung 432 folgende Instruktion RSA_UPY_433 des Unterprogramms UPY 430 wird dabei bevorzugterweise in einem Register gespeichert, kann aber auch auf dem Aufrufstapel des Aufrufstapelspeichers 480 gespeichert werden. Nach erfolgtem Sprung (S5) zur Eintrittsroutine ER 450 liest diese die Rücksprungadresse RSA_UPY_433 aus dem Register oder dem Aufrufstapel aus, wobei in letzterem Fall die Rücksprungadresse RSA_UPY_433 von dem Aufrufstapel entfernt wird. Die Rücksprungadresse RSA_UPX in dem dem Unterprogramm UPY 430 zugeordneten Eintrag 484 in dem Aufrufstapelspeicher 480 wird durch die Adresse RSA_AR, die auf den Beginn der Austrittsroutine AR 460 des Ablaufverfolgungsmoduls AVM 440 verweist, ersetzt und die Rücksprungadresse RSA_UPX wird in dem Hilfsstapelspeicher 490 in einem neuen Eintrag 494 gespeichert (400E). Die Eintrittsroutine ER 450 registriert den Eintritt in das Unterprogramm UPY 430. Nach Beendigung der Eintrittsroutine ER 450 wird an die zuvor ausgelesene Adresse RSA_UPY_433 des Unterprogramms UPY 430 zurückgesprungen (S6).Thereupon the instructions become 424 subprogram UPX 420 executed until instruction 425 a subroutine UPY 430 is called. The address of the call 425 following instruction 426 of the subroutine UPY 430 is in the call stack 480 in a called subroutine UPY 430 associated entry or frame 484 stored as a return address RSA_UPX ( 400D ) and it gets to the beginning 432 of the subroutine UPY 430 jumped (S4). Subroutine UPY has been developed in accordance with the 3b instrumented for tracing. That's why it's at the beginning 432 of the subroutine UPY 430 a jump instruction to the entry routine ER 450 the trace module AVM 440 , The jump instruction 432 following instruction RSA_UPY_ 433 of the subroutine UPY 430 is preferably stored in a register, but may also be on the call stack of the call stack 480 get saved. After the jump (S5) to the entry routine ER 450 this reads the return address RSA_UPY_ 433 from the register or the call stack, in the latter case the return address RSA_UPY_ 433 is removed from the call stack. The return address RSA_UPX in the subprogram UPY 430 associated entry 484 in the call stack 480 is determined by the address RSA_AR, which indicates the beginning of the exit routine AR 460 the trace module AVM 440 refers, replaces, and the return address is RSA_UPX in the auxiliary stack 490 in a new entry 494 saved ( 400E ). The entry routine ER 450 registers the entry into the subroutine UPY 430 , After completion of the entry routine ER 450 is sent to the previously read address RSA_UPY_ 433 of the subroutine UPY 430 jumped back (S6).

Daraufhin werden die Instruktionen 434 des Unterprogramms UPY 430 sequentiell abgearbeitet. Am Ende 435 des Unterprogramms UPY 430 wird zu der Adresse gesprungen, die im obersten Eintrag des Aufrufstapelspeichers 480 abgelegt ist (S7). Dies ist die Adresse RSA_AR, die im Eintrag 484 des Aufrufstapels abgelegt ist. Daher wird nicht, wie sonst üblich, der Kontrollfluss an das Unterprogramms UPX 420, das das Unterprogramm UPY 430 aufgerufen hat, zurückgegeben, sondern zu einer von dem Ablaufverfolgungsmodul AVM 440 zur Verfügung gestellten Austrittsroutine AR 460. Der oberste Eintrag 484 wird dabei aus dem Aufrufstapelspeicher 480 entfernt (400F). Die Austrittsroutine 460 registriert den Austritt aus dem Unterprogramm UPY 430 und springt dann zu der Adresse zurück (S8), die im obersten Eintrag 494 des Hilfsstapelspeichers 490 abgelegt ist, also zu der Adresse RSA_UPX, die der Instruktion 426 des Unterprogramms UPX 420 entspricht. Der oberste Eintrag 494 wird dabei aus dem Hilfsstapelspeicher 490 entfernt (400G).Thereupon the instructions become 434 of the subroutine UPY 430 processed sequentially. At the end 435 of the subroutine UPY 430 is jumped to the address in the top entry of the call stack 480 is stored (S7). This is the address RSA_AR in the entry 484 the call stack is stored. Therefore, as usual, the control flow to the subprogram UPX is not 420 which is the subprogram UPY 430 but returned to one of the trace module AVM 440 provided exit routine AR 460 , The top entry 484 becomes from the call stack memory 480 away ( 400F ). The exit routine 460 registers the exit from the subroutine UPY 430 and then jump back to the address (S8) in the top entry 494 the auxiliary stack 490 is stored, that is, to the address RSA_UPX, that of the instruction 426 subprogram UPX 420 equivalent. The top entry 494 becomes from the auxiliary stack 490 away ( 400G ).

Die Instruktionen 427 des Unterprogramms UPX 420 werden daraufhin sequentiell ausgeführt und am Ende 428 des Unterprogramms UPX 420 wird dann zu der Adresse gesprungen, die im obersten Eintrag des Aufrufstapelspeichers 480 abgelegt ist (S9). Dies ist wiederum die Adresse RSA_AR, die dem Beginn der Austrittsroutine AR 460 des Ablaufverfolgungsmoduls AVM 440 entspricht. Der oberste Eintrag wird dabei aus dem Aufrufstapelspeicher 480 entfernt, so dass zu diesem Zeitpunkt keine Einträge mehr zu aktiven Unterprogrammen in dem Aufrufstapelspeicher vorhanden sind (400H). Die Austrittsroutine AR 460 registriert den Austritt aus dem Unterprogramm UPX 420 und gibt den Kontrollfluss daraufhin an die Adresse zurück, die im obersten Eintrag des Hilfsstapelspeichers 490 abgelegt ist (S10). Dies ist die Adresse RSA_HP, die der Instruktion 414 des Hauptprogrammteils entspricht, in dem Eintrag 492 des Hilfsstapelspeichers 490. Dabei wird der Eintrag 492 aus dem Hilfsstapelspeicher 490 entfernt, der damit zu diesem Zeitpunkt leer ist. Daraufhin werden die weiteren Instruktionen 415 des Hauptprogrammteils HP 410 sequentiell abgearbeitet. Wie im Zusammenhang mit 3 beschrieben kann der Kontrollfluss direkt oder über ein Zentralmodul ZM 445 zu und von der Eintrittsroutine ER 450 bzw. der Austrittsroutine AR 460 gelenkt werden.The instructions 427 subprogram UPX 420 are then executed sequentially and at the end 428 subprogram UPX 420 is then jumped to the address in the top entry of the call stack 480 is stored (S9). This, in turn, is the address RSA_AR which is the beginning of the exit routine AR 460 the trace module AVM 440 equivalent. The top entry will be from the call stack 480 removed so that there are no more active subprograms in the call stack memory at this time ( 400H ). The exit routine AR 460 registers the exit from the subroutine UPX 420 and then returns the control flow to the address in the top entry of the auxiliary stack 490 is stored (S10). This is the address RSA_HP, that of the instruction 414 of the main program part corresponds to the entry 492 the auxiliary stack 490 , This will be the entry 492 from the auxiliary stack 490 removed, which is empty at this time. Thereupon the further instructions become 415 of the main program part HP 410 processed sequentially. As related to 3 the control flow can be described directly or via a central module ZM 445 to and from the entry routine ER 450 or the exit routine AR 460 be steered.

Es wird wiederum darauf hingewiesen, dass die in die Unterprogramme UPX 420 und UPY 430 eingebrachte Sprunganweisung JMP_AVM eine direkte oder indirekte Umleitung zu der Eintrittsroutine ER 450 des Ablaufverfolgungsmoduls 440 darstellt. Im Falle einer indirekten Umleitung mittels einer Kurzsprung/Langsprung-Kombination würden als Rücksprungadressen die Adressen RSA_UPX_422 und RSA_UPY_432 anstelle der korrekten Adressen RSA_UPX_423 und RSA_UPX_433 als Folge der Sprünge S2 und S5 zu der Eintrittsroutine ER 450 gespeichert, die daraus wiederum die korrekten Rücksprungadressen RSA_UPX_423 und RSA_UPX_433 ableitet.It is again pointed out that the subprograms UPX 420 and UPY 430 introduced jump instruction JMP_AVM direct or indirect diversion to the entry routine ER 450 of the trace module 440 represents. In the case of an indirect diversion by means of a short jump / long jump combination, the addresses RSA_UPX_ would be used as return addresses. 422 and RSA_UPY_ 432 instead of the correct addresses RSA_UPX_ 423 and RSA_UPX_ 433 as a result of the jumps S2 and S5 to the entry routine ER 450 which in turn stores the correct return addresses RSA_UPX_ 423 and RSA_UPX_ 433 derives.

Im Zusammenhang mit den 3 und 4 wurde aufgezeigt, wie ein Unterprogramm zur Laufzeit instrumentiert werden kann und wie der Eintritt in ein solches Unterprogramm und der Austritt aus einem solchen Unterprogramm registriert werden können. In 5 wird nun ein Mechanismus vorgestellt, mit dem auch das Auftreten einer Ausnahme berücksichtigt werden kann.In connection with the 3 and 4 It was shown how a subroutine can be instrumented at runtime and how to register for such subroutine and exit from such subroutine. In 5 Now a mechanism is presented, with which also the occurrence of an exception can be considered.

Ausnahmen zeigen Probleme an, die während der Ausführung eines Programms bzw. Unterprogramms auftreten können. Typische Ausnahmen zeigen z. B. den Versuch, durch Null zu teilen, auf eine nicht vorhandene Speicheradresse zuzugreifen oder andere Problemsituationen an, die bei der Abarbeitung des Programms bzw. Unterprogramms auftreten. Ausnahmen können durch speziell dafür vorgesehene Ausnahmebehandlungsfunktionen behandelt werden. Nach einer erfolgreichen Behandlung einer Ausnahme kann dabei die unterbrochene Programmausführung entweder an einer Stelle innerhalb des Unterprogramms aufgenommen werden, in dem die Ausnahme aufgetreten ist, oder an einer anderen stabilen Stelle im Programmcode, was zu einer kontrollierten, nicht-regulären Beendigung des Unterprogramms führt. Kann keine Ausnahmebehandlungsfunktion die aufgetretene Ausnahme behandeln, folgt zumeist ein Absturz des Programms.Exceptions indicate problems that occur during the execution of a program or Subprogram can occur. Typical exceptions show z. Example, the attempt to divide by zero, to access a non-existent memory address or other problem situations that occur during the execution of the program or subroutine. Exceptions can be handled by special exception handling functions. Upon successful handling of an exception, the interrupted program execution may be taken either at a location within the subroutine in which the exception occurred, or at some other stable location in the program code, resulting in a controlled, non-regular termination of the subroutine. If no exception handling function can handle the exception that has occurred, it is usually followed by a crash of the program.

Jedes Unterprogramm eines Programms kann eine spezielle Ausnahmebehandlungsfunktion definieren, die Anweisungen darüber enthält, wie beim Auftreten bestimmter Ausnahmen weiter zu verfahren ist. Nicht jedes Unterprogramm muss notwendigerweise eine solche Ausnahmebehandlungsfunktion aufweisen und nicht jede Ausnahmebehandlungsfunktion enthält üblicherweise Anweisungen für jede denkbare auftretende Ausnahme.Each subprogram of a program can define a special exception handler that contains instructions on how to proceed when certain exceptions occur. Not every subroutine must necessarily have such an exception handling function, and not every exception handling function usually contains instructions for every conceivable exception.

Nach Aufruf eines Unterprogramms wird, sofern vorhanden, die entsprechende Ausnahmebehandlungsfunktion des Unterprogramms registriert, d. h. deren Adresse an einem bekannten, dafür vorgesehenen Ort abgelegt. Die Registrierungen von Ausnahmebehandlungsfunktionen verschiedener Unterprogramme können an diesem Ort als Kette von Ausnahmebehandlungsregistrierungen abgelegt sein. Tritt eine Ausnahme bei der Abarbeitung dieses Unterprogramms auf, wird auf die zugehörige registrierte Ausnahmebehandlungsfunktion mittels der gespeicherten Adresse zugegriffen. Ist die Ausnahmebehandlungsfunktion jedoch nicht in der Lage die aufgetretene Ausnahme erfolgreich zu behandeln, wird überprüft, ob eine andere zuvor von einem anderen Unterprogramm registrierte Ausnahmebehandlungsfunktion diese Ausnahme behandeln kann.When a subroutine is called, the corresponding exception handling function of the subroutine is registered, if any, d. H. their address stored in a known, designated place. The registrations of exception handling functions of various subroutines may be stored at this location as a chain of exception handling registrations. If an exception occurs during the execution of this subroutine, the associated registered exception handling function is accessed by means of the stored address. However, if the exception handler fails to successfully handle the exception that has occurred, it checks to see if another exception handler previously registered by another subprogram can handle this exception.

Grundsätzlich kann nach einer erfolgreichen Ausnahmebehandlung entweder die Ausführung des Programms innerhalb des Unterprogramms, in dem die Ausnahme aufgetreten ist fortgesetzt werden, oder an einer anderen durch die erfolgreiche Ausnahmebehandlungsfunktion bestimmten Stelle. In letzterem Fall wird zumeist der Aufrufstapel bis zu dem Eintrag abgewickelt, der dem Unterprogramm entspricht, der die erfolgreiche Ausnahmebehandlungsfunktion registriert hat. Diese Form der Ausnahmebehandlung über eine Kette von registrierten Ausnahmebehandlungsfunktionen wird auch als strukturierte Ausnahmebehandlung bezeichnet.In principle, after a successful exception handling, either the execution of the program can be continued within the subprogram in which the exception occurred, or at another location determined by the successful exception handling function. In the latter case, the call stack is usually handled up to the entry corresponding to the subroutine that registered the successful exception handling function. This form of exception handling via a chain of registered exception handling functions is also referred to as structured exception handling.

Bei der dynamisch aktivierten Ablaufverfolgung von Unterprogrammen könnte eine derartige strukturierte Ausnahmebehandlung bei Abwicklung einer oder mehrerer Einträge bzw. Aufrufrahmen des Aufrufstapels von ablaufverfolgten Unterprogrammen dazu führen, dass die Kohärenz zwischen Aufrufstapel und Hilfsstapel nicht mehr gegeben ist, da Einträge bzw. Hilfsrahmen zu Unterprogrammen im Hilfsstapelspeicher stehen bleiben könnten, die nach Abwicklung des Aufrufstapels nicht mehr aktiv sind. Die folgende mit Bezug auf 5 beschriebene bevorzugte Ausführungsform der vorliegenden Erfindung berücksichtigt das Auftreten von Ausnahmen und ermöglicht, sowohl das Auftreten von Ausnahmen, die zu einer Aufrufstapelabwicklung führen, und/oder die durch diese verursachten Aufrufstapelabwicklungen zu protokollieren, als auch die Kohärenz zwischen Aufrufstapel und Hilfsstapel aufrecht zu erhalten.In the case of the dynamically activated tracing of subroutines, such a structured exception handling when processing one or more entries or call frames of the call stack of run-tracked subroutines could result in the coherency between call stack and auxiliary stack no longer being present, since entries or subframes become subroutines in the auxiliary stack could remain standing, which are no longer active after processing the call stack. The following with reference to 5 The preferred embodiment of the present invention contemplates the occurrence of exceptions and allows both the occurrence of exceptions that result in call stack handling and / or the call stack handlers caused by them to be maintained, as well as maintaining coherency between the call stack and auxiliary stack.

Dazu stellt das Ablaufverfolgungsmodul gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung eine eigenen Ausnahmebehandlungsfunktion bereit, die jeweils vor Eintritt eines zu verfolgenden Unterprogramms registriert sowie nach regulärer Beendigung desselben deregistriert wird. Um eine Registrierung mit Hilfe eines eigenen Aufrufrahmens für das Ablaufverfolgungsmodul im Aufrufstapel und damit deren negative Konsequenz für Zugriffe auf durch Aufrufstapelzeiger-relative Offsets adressierte Parameter durch das zu verfolgende Unterprogramm zu vermeiden, wird eine bereits bestehende Registrierung einer Ausnahmebehandlungsfunktion angepasst. Diese bestehende Registrierung entspricht dabei der Ausnahmebehandlungsfunktion, auf die im Fall einer nicht innerhalb des verfolgten Unterprogramms bzw. durch deren Ausnahmebehandlungsfunktion behandelbaren Ausnahme als Nächstes zugegriffen würde. Wird eine Ausnahmebehandlungsregistrierungskette verwendet, entspricht diese bestehende Registrierung dementsprechend dem obersten Glied bzw. Eintrag in der Ausnahmebehandlungsregistrierungskette. Die Anpassung besteht darin, die Adresse der Ausnahmebehandlungsfunktion dieser bestehenden Registrierung durch die Adresse der von dem Ablaufverfolgungsmodul bereitgestellten Ausnahmebehandlungsfunktion zu ersetzen. Die Adresse der ursprünglichen Ausnahmebehandlungsfunktion wird in einem dem zu verfolgenden Unterprogramm zugeordneten Eintrag bzw. Hilfsrahmen in einem Hilfsstapelspeicher abgelegt, zusammen mit der Adresse der veränderten Registrierung.For this purpose, according to a preferred embodiment of the present invention, the trace module provides its own exception handling function, which is registered in each case before entry of a subroutine to be tracked and deregistered after regular termination thereof. In order to avoid registration by means of its own call frame for the trace module in the call stack, and thus its negative consequence for accesses to parameters addressed by call stack pointer relative offsets by the subroutine to be followed, an existing registration of an exception handling function is adapted. This existing registration corresponds to the exception handling function that would be accessed next in the event of an exception that is not within the tracked subroutine or exception handling function. Accordingly, if an exception handling registration chain is used, this existing registration corresponds to the topmost member or entry in the exception handling registration chain. The adaptation consists of replacing the address of the exception handling function of this existing registration with the address of the exception handling function provided by the trace module. The address of the original exception handling function is stored in an auxiliary stack in an entry or subframe associated with the subroutine to be followed, along with the address of the changed registry.

5 illustriert die Berücksichtigung von Ausnahmen gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung. In Schritt 510 wird ein Unterprogramm UPX, für welches eine Ablaufverfolgung wie oben gezeigt dynamisch aktiviert worden ist, aus einem laufenden Programm aufgerufen. Aufgrund der Instrumentierung wird der Programmkontrollfluss in Schritt 515 zum Ablaufverfolgungsmodul AVM umgelenkt. Das Ablaufverfolgungsmodul AVM stellt eine eigene Ausnahmebehandlungsfunktion EXC_AVM zur Verfügung, die in Schritt 520 registriert, d. h. deren Adresse an einer für diesen Zweck vom Betriebssystem vorgesehenen Stelle im Arbeitsspeicher abgelegt wird. 6 zeigt den Ablauf einer solchen Registrierung gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung. Nach der Registrierung wird der Eintritt in das Unterprogramm UPX in Schritt 525 registriert. Dies kann durch eine Eintrittsprotokollroutine ER innerhalb des Ablaufverfolgungsmoduls AVM bewerkstelligt werden. Die von dem Ablaufverfolgungsmodul durchgeführten Schritte der Registrierung der Ausnahmebehandlungsfunktion EXC_AVM 520 und der Eintrittsregistrierung 525 können in ihrer Reihenfolge auch vertauscht sein. Danach wird der Programmkontrollfluss an das Unterprogramm UPX in Schritt 530 zurückgegeben und die einzelnen Instruktionen des Unterprogramms UPX werden abgearbeitet. Verfügt das Unterprogramm UPX über eine eigene Ausnahmebehandlungsfunktion EXC_UPX, schließt die Abarbeitung des Unterprogramms UPX auch die Registrierung der Ausnahmebehandlungsfunktion EXC_UPX mit ein. Während des Ablaufs des Unterprogramms UPX wird überwacht, ob eine Ausnahme auftritt, die nicht innerhalb des Unterprogramms UPX bzw. durch deren Ausnahmebehandlungsfunktion EXC_UPX erfolgreich behandelt werden kann; dies ist durch Schritt 535 symbolisiert. Tritt bis zum Ende des Unterprogramms UPX keine derartige Ausnahme auf, wird, falls vorhanden, die durch das Unterprogramm UPX registrierte Ausnahmebehandlungsfunktion EXC_UPX deregistriert und der Programmkontrollfluss aufgrund der Instrumentierung von UPX in Schritt 540 wieder zum Ablaufverfolgungsmodul AVM zurückgegeben. Das Ablaufverfolgungsmodul AVM registriert den Austritt aus dem Unterprogramm UPX in Schritt 545. Dies kann z. B. durch eine vom Ablaufverfolgungsmodul bereitgestellte Austrittsprotokollroutine AR vorgenommen werden. Daraufhin wird in Schritt 550 die registrierte Ausnahmebehandlungsfunktion EXC_AVM deregistriert, d. h. die zuvor an der vorgesehenen Stelle im Arbeitsspeicher abgelegte Adresse EXC_AVM wieder entfernt. Ähnlich zu den Schritten der Registrierung der Ausnahmebehandlungsfunktion EXC_AVM 520 und Eintrittsregistrierung 525 können auch die Schritte der Austrittsregistrierung 545 und Deregistrierung der Ausnahmebehandlungsfunktion EXC_AVM 550 in ihrer Reihenfolge vertauscht werden. Daraufhin wird in Schritt 555 der Programmkontrollfluss entsprechend der für das Unterprogramm UPX vorgesehenen Rücksprungadresse ADR_UPX zurückgegeben, wie weiter oben näher erläutert. 5 illustrates the consideration of exceptions according to a preferred embodiment of the present invention. In step 510 For example, a subroutine UPX for which a trace has been dynamically activated as shown above is called from a running program. Due to the instrumentation, the program control flow in step 515 redirected to the trace module AVM. The trace module AVM provides its own exception handling function EXC_AVM, which in step 520 registered, ie their address is stored in a designated for this purpose by the operating system in the working memory. 6 shows the flow of such a registration according to a preferred embodiment of the present invention. After registration, entry into the UPX subroutine will be in step 525 registered. This can be accomplished by an entry protocol routine ER within the trace module AVM. The steps performed by the trace module to register the exception handling function EXC_AVM 520 and entry registration 525 can also be reversed in their order. Thereafter, the program control flow to the subroutine UPX in step 530 are returned and the individual instructions of the UPX subroutine are processed. If the subroutine UPX has its own exception handling function EXC_UPX, the execution of the subroutine UPX also includes the registration of the exception handling function EXC_UPX. During the execution of the subroutine UPX, it is monitored whether an exception occurs that can not be successfully handled within the subroutine UPX or by its exception handling function EXC_UPX; this is by step 535 symbolizes. If no such exception occurs up to the end of the subroutine UPX, the exception handling function EXC_UPX registered by the subroutine UPX, if any, is deregistered and the program control flow due to the instrumentation of UPX in step 540 returned to the trace module AVM. The trace module AVM registers the exit from the subroutine UPX in step 545 , This can be z. B. be made by a provided by the trace module exit log routine AR. Then in step 550 the registered exception handling function EXC_AVM deregistered, ie the previously stored at the intended location in the working memory address EXC_AVM removed again. Similar to the steps of registering the exception handling function EXC_AVM 520 and entry registration 525 can also follow the steps of exit registration 545 and deregistration of exception handling function EXC_AVM 550 be reversed in their order. Then in step 555 the program control flow is returned in accordance with the return address ADR_UPX provided for the subroutine UPX, as explained in greater detail above.

Tritt allerdings in Schritt 535 eine Ausnahme während der Abarbeitung des Unterprogramms UPX auf, die nicht innerhalb des Unterprogramms UPX bzw. durch deren Ausnahmebehandlungsfunktion EXC_UPX erfolgreich behandelt werden kann, wird die registrierte Ausnahmebehandlungsfunktion EXC_AVM des Ablaufverfolgungsmoduls AVM in Schritt 560 aufgerufen. Die Ausnahmebehandlungsfunktion EXC_AVM dient dazu, die bei der Registrierung der Ausnahmebehandlungsfunktion EXC_AVM verdrängte eigentliche Ausnahmebehandlungsfunktion EXC_UPV eines aktiven Unterprogramms UPV aufzurufen und dafür zu sorgen, dass im Falle einer notwendigen Abwicklung des Aufrufrahmens der Unterfunktion UPX vom Aufrufstapelspeicher keine dem Unterprogramm UPX zugeordneten Einträge in einem Hilfsstapelspeicher stehen bleiben. Wird also ein dem Unterprogramm UPX zugeordneter Aufrufrahmen abgewickelt, wird auch ein dem Unterprogramm UPX zugeordneter Hilfsrahmen abgewickelt. Zudem kann die Ausnahmebehandlungsfunktion EXC_AVM die Protokollierung des Auftretens der Ausnahme, die erfolgreiche oder nicht erfolgreiche Ausnahmebehandlung durch die Ausnahmebehandlungsfunktion EXC_UPV und/oder die Abwicklung des Aufrufrahmens und des Hilfsrahmens veranlassen. Dies wird in 5 durch Schritt 565 symbolisiert. Ein detailliertes Beispiel für das Zusammenwirken der Ausnahmebehandlungsfunktionen EXC_AVM und EXC_UPV wird weiter unten im Zusammenhang mit 7 beschrieben.However, step in 535 an exception during the execution of the subroutine UPX, which can not be successfully handled within the subroutine UPX or by its exception handling function EXC_UPX, the registered exception handling function EXC_AVM of the trace module AVM in step 560 called. The exception handling function EXC_AVM serves to call the actual exception handling function EXC_UPV of an active subprogram UPV displaced during the registration of the exception handling function EXC_AVM and to ensure that in the case of a necessary handling of the call frame of the subfunction UPX of the call stack memory no entries associated with the subroutine UPX are in an auxiliary stack stay. Therefore, if a call frame assigned to the subroutine UPX is handled, an auxiliary frame assigned to the subroutine UPX is also handled. In addition, the exception handling function EXC_AVM may cause the occurrence of the exception logging, the successful or unsuccessful exception handling by the exception handling function EXC_UPV, and / or the handling of the call frame and the subframe. This will be in 5 by step 565 symbolizes. A detailed example of the interaction of exception handling functions EXC_AVM and EXC_UPV will be discussed below 7 described.

6 zeigt ein Beispiel für einen Registrierungsvorgang für eine Ausnahmebehandlungsfunktion EXC_AVM, wenn vom Betriebssystem vorgesehen ist, Ausnahmebehandlungsfunktionen als verkettete Einträge zu registrieren. Dies ist z. B. bei Windows NT oder OS/2 auf Intel 32-bit/IA-32 Systemen im Rahmen der strukturierten Ausnahmebehandlung der Fall. Dabei wird nach Aufruf eines Unterprogramms die zu der von diesem Unterprogramm bereitgestellten Ausnahmebehandlungsfunktion gehörige Adresse als oberster Eintrag in einer Kette von Ausnahmebehandlungsregistrierungseinträgen abgelegt. Zudem wird in diesem Eintrag auch eine Adresse bzw. ein Zeiger zu dem vorherigen obersten Eintrag der Ausnahmebehandlungsregistrierungskette abgelegt. Falls beim Auftreten einer Ausnahme während eines Ablaufs eines Unterprogramms diese Ausnahme von der von diesem Unterprogramm registrierten Ausnahmebehandlungsfunktion nicht behandelt werden kann, wird zu dem vorhergehenden Eintrag in der Ausnahmebehandlungsregistrierungskette gesprungen und überprüft, ob die darin registrierte Ausnahmebehandlungsfunktion die aufgetretene Ausnahme behandeln kann. Auf diese Weise kann die Ausnahmebehandlungsregistrierungskette solange von oben nach unten untersucht werden, bis eine geeignete Ausnahmebehandlungsfunktion gefunden wird. 6 shows an example of a registration process for an exception handling function EXC_AVM when the operating system is intended to register exception handling functions as linked entries. This is z. For example, in Windows NT or OS / 2 on Intel 32-bit / IA-32 systems in the context of structured exception handling the case. In this case, after calling a subroutine, the address belonging to the exception handling function provided by this subroutine is stored as the top entry in a chain of exception handling registration entries. In addition, this entry also stores an address or a pointer to the previous top entry of the exception handling registration chain. If, on the occurrence of an exception during a subroutine operation, this exception can not be handled by the exception handling function registered by this subroutine, the previous entry in the exception handling registration chain is skipped and a check is made as to whether the exception handling function registered therein can handle the exception that has occurred. In this way, the exception handling registration chain can be examined from top to bottom until a suitable exception handling function is found.

Bei diesem Vorgehen wird eine Adresse bzw. ein Zeiger zu dem Eintrag in der Ausnahmebehandlungsregistrierungskette, der die Ausnahmebehandlungsfunktion eines Unterprogramms registriert und somit deren Adresse enthält, in dem Aufrufrahmen dieses Unterprogramms gespeichert. Für das Ablaufverfolgungsmodul wird jedoch bevorzugterweise kein eigener Aufrufrahmen erstellt, damit das Verhalten des zu verfolgenden Unterprogramms sowie die Laufzeitumgebung des Programms so wenig wie möglich durch die dynamisch aktivierte Ablaufverfolgung beeinflusst werden. Zudem sollen bevorzugterweise Probleme bei Zugriffen auf durch Aufrufstapelzeiger-relative Offsets adressierte Parameter vermieden werden. Deshalb wird in einer bevorzugten Ausführungsform der vorliegenden Erfindung die Ausnahmebehandlungsfunktion EXC_AVM des Ablaufverfolgungsmoduls AVM dadurch registriert, dass die Adresse in einem bereits bestehenden obersten Eintrag in der Ausnahmebehandlungsregistrierungskette durch die Adresse von EXC_AVM ersetzt wird. Die Adresse der ursprünglich im obersten Eintrag registrierten Ausnahmebehandlungsfunktion wird stattdessen in einem Hilfsrahmen abgelegt. In this procedure, an address or pointer to the entry in the exception handling registration chain which registers the exception handling function of a subroutine and thus contains its address is stored in the call frame of this subroutine. However, the trace module preferably does not create its own call frame, so that the behavior of the subroutine to be tracked and the runtime environment of the program are as little affected by the dynamically activated trace as possible. In addition, it is preferable to avoid problems in accessing parameters addressed by call stack pointer relative offsets. Therefore, in a preferred embodiment of the present invention, the exception handling function EXC_AVM of the trace module AVM is registered by replacing the address in an already existing top entry in the exception handling registration chain with the address of EXC_AVM. The address of the exception handling function originally registered in the top entry is instead stored in a subframe.

In der in 6 dargestellten bevorzugten Ausführungsform der vorliegenden Erfindung wird in Schritt 610 zuerst geprüft, ob die Ausnahmebehandlungsregistrierungskette leer ist. Ist dies der Fall, wird keine Registrierung vorgenommen (630), da davon ausgegangen wird, dass keine Aufrufstapelabwicklungen auftreten. Ist die Ausnahmebehandlungsregistrierungskette jedoch nicht leer, wird in Schritt 615 überprüft, ob im obersten Eintrag der Ausnahmebehandlungsregistrierungskette die Adresse der von dem Ablaufverfolgsmodul AVM bereitgestellten Ausnahmebehandlungsfunktion EXC_AVM bereits eingetragen ist. Dies kann z. B. der Fall sein, wenn der oberste Eintrag in der Ausnahmebehandlungsregistrierungskette einem früher aufgerufenen, noch aktiven Unterprogramm entspricht, das ebenfalls für die Ablaufverfolgung durch das Ablaufverfolgungsmodul AVM instrumentiert worden ist.In the in 6 illustrated preferred embodiment of the present invention is in step 610 first checked if the exception handling registration chain is empty. If this is the case, no registration is made ( 630 ), since it is assumed that no call stack transactions occur. However, if the exception handler registration chain is not empty, then in step 615 checks whether the address of the exception handling function EXC_AVM provided by the trace module AVM has already been entered in the top entry of the exception handling registration chain. This can be z. For example, if the top entry in the exception handling registration string corresponds to a previously invoked, still active subroutine that has also been instrumented for tracing by the trace module AVM.

Ist die Adresse der Ausnahmebehandlungsfunktion EXC_AVM noch nicht im obersten Eintrag der Ausnahmebehandlungsregistrierungskette eingetragen, wird in Schritt 620 die in dem obersten Eintrag der Ausnahmebehandlungsregistrierungskette abgelegte Adresse ADR_EXC_UPV der von dem Unterprogramm UPV bereitgestellten Ausnahmebehandlungsfunktion EXC_UPV durch die Adresse ADR_EXC_AVM der von dem Ablaufverfolgungsmodul AVM bereitgestellten Ausnahmebehandlungsfunktion EXC_AVM ersetzt und in Schritt 625 die ersetzte Adresse ADR_EXC_UPV im Hilfsrahmen des Unterprogramms UPX gemeinsam mit einer Adresse bzw. einem Zeiger zu diesem Eintrag der Ausnahmebehandlungsregistrierungskette abgelegt. Die Schritte des Ersetzens 620 und Speicherns 625 können dabei in ihrer Reihenfolge vertauscht sein.If the address of the exception handling function EXC_AVM has not yet been entered in the top entry of the exception handling registration chain, then in step 620 the address ADR_EXC_UPV stored in the top entry of the exception handling registration string replaces the exception handling function EXC_UPV provided by the subroutine UPV with the address ADR_EXC_AVM of the exception handling function EXC_AVM provided by the trace module AVM, and in step 625 the replaced address ADR_EXC_UPV in the subframe of the subroutine UPX is stored together with an address or a pointer to this entry of the exception handling registration chain. The steps of replacing 620 and saving 625 can be reversed in their order.

Wird in Schritt 615 jedoch festgestellt, dass sich die Adresse von EXC_AVM bereits im obersten Eintrag der Ausnahmebehandlungsregistrierungskette befindet, wird in Schritt 635 das Unterprogramm identifiziert, das die Ersetzung der ursprünglich registrierten Ausnahmebehandlungsfunktion veranlasst hat. Diese Identifizierung kann z. B. durch die Bestimmung des Hilfsrahmens, in dem eine Adresse bzw. ein Zeiger zu diesem Eintrag in der Ausnahmebehandlungsregistrierungskette gespeichert ist, vorgenommen werden. Daraufhin wird in Schritt 640 die Adresse des identifizierten Hilfsrahmens im Hilfsrahmen des Unterprogramms UPX gespeichert. Tritt während des Ablaufs des Unterprogramms UPX eine Ausnahme auf, wird aufgrund des obersten Eintrags der Ausnahmebehandlungsregistrierungskette die Ausnahmebehandlungsfunktion EXC_AVM aufgerufen. Über die im Hilfsrahmen des Unterprogramms UPX gespeicherte Adresse des Hilfsrahmens des Unterprogramms, das die Ersetzung der ursprünglichen Ausnahmebehandlungsfunktion vorgenommen hat, kann dieser Hilfsrahmen lokalisiert und über die darin gespeicherte Adresse die durch EXC_AVM verdrängte ursprünglichen Ausnahmebehandlungsfunktion aufgerufen werden.Will in step 615 however, it is determined that the address of EXC_AVM is already in the top entry of the exception handler registration chain 635 identifies the subroutine that caused the replacement of the originally registered exception handling function. This identification can z. By the determination of the subframe in which an address or a pointer to this entry is stored in the exception handling registration chain. Then in step 640 stored the address of the identified subframe in the subframe of the subprogram UPX. If an exception occurs during the execution of the subroutine UPX, the exception handling function EXC_AVM is called on the basis of the top entry of the exception handling registration chain. The auxiliary subframe address stored in the subframe of the subroutine UPX, which has made the replacement of the original exception handling function, can be localized and the original exception handling function suppressed by EXC_AVM can be called via the address stored therein.

Eine Ausnahmebehandlungsfunktion hat allgemein folgende Möglichkeiten, mit einer aufgetretenen Ausnahme umzugehen: (a) Erfolgreiche Behandlung der Ausnahme und Rückkehr zu dem Unterprogramm, bei dem die Ausnahme aufgetreten ist; (b) Erfolgreiche Behandlung der Ausnahme mit Abwicklung zumindest des Aufrufrahmens des Unterprogramms, bei dem die Ausnahme aufgetreten ist; und (c) keine Behandlung der Ausnahme. Im Rahmen der hier vorgestellten Ablaufverfolgung ist vor allem interessant, wie sich die Fälle (a) bis (c) auf die Kohärenz zwischen Aufrufstapel und Hilfsstapel auswirken.An exception handling function generally has the following capabilities to deal with an exception that has occurred: (a) successfully handle the exception and return to the subroutine in which the exception occurred; (b) successful handling of the exception, with at least the call-frame of the sub-program in which the exception occurred; and (c) no treatment of the exception. Of particular interest in the context of the trace presented here is how cases (a) to (c) affect the coherence between the call stack and the auxiliary stack.

Der Fall (a) hat keine Auswirkungen auf den Aufrufstapel und den Hilfsstapel, d. h. die Kohärenz zwischen beiden ist gewährleistet. Im Fall (c) wird anhand der Ausnahmebehandlungsregistrierungskette weiter nach einer geeigneten Ausnahmebehandlungsfunktion gesucht, d. h. die Kohärenz zwischen Aufrufstapel und Hilfsstapel ist zu diesem Zeitpunkt ebenfalls nicht gefährdet. Wird später eine geeignete Ausnahmebehandlungsfunktion gefunden, die eine Abwicklung des Aufrufstapels veranlasst, wird die in der Ausnahmebehandlungsregistrierungskette registrierte Ausnahmebehandlungsfunktion EXC_AVM automatisch erneut aufgerufen und kann dadurch eine entsprechende Abwicklung des Hilfsstapels vornehmen, so dass die Kohärenz zwischen Aufrufstapel und Hilfsstapel ebenfalls erhalten bleibt.Case (a) has no effect on the call stack and the auxiliary stack; H. the coherence between the two is guaranteed. In case (c), the exception handler registration chain continues to search for an appropriate exception handling function, i. H. The coherence between the call stack and the auxiliary stack is also not endangered at this time. If a suitable exception handling function is subsequently found which causes the call stack to be processed, the exception handling function EXC_AVM registered in the exception handling registration chain is automatically called again and can thus carry out a corresponding handling of the auxiliary stack, so that the coherency between call stack and auxiliary stack is also preserved.

Anders verhält es sich im Fall (b), wenn eine ursprüngliche Ausnahmebehandlungsfunktion indirekt über die in der Ausnahmebehandlungsregistrierungskette registrierte Ausnahmebehandlungsfunktion EXC_AVM aufgerufen wird. Veranlasst diese ursprüngliche Ausnahmebehandlungsfunktion eine Abwicklung des Aufrufstapels, wird die in der Ausnahmebehandlungsregistrierungskette registrierte Ausnahmebehandlungsfunktion EXC_AVM nicht nochmals aufgerufen, da die ursprüngliche Ausnahmebehandlungsfunktion davon ausgeht, dass sie selbst in dem entsprechenden Eintrag in der Ausnahmebehandlungsregistrierungskette registriert ist und keine Kenntnis von der Registrierung der Ausnahmebehandlungsfunktion EXC_AVM in diesem Eintrag hat. Daher würde im Fall (b) der Aufrufstapel abgewickelt und die Ausführung des Programms an einer von der ursprünglichen Ausnahmebehandlungsfunktion vorgesehenen Stelle wieder aufgenommen, ohne dass der Hilfsstapel entsprechend abgewickelt wurde. Um dies zu verhindern, sieht eine bevorzugte Ausführungsform der vorliegenden Erfindung vor, eine weitere von dem Ablaufverfolgungsmodul AVM zur Verfügung gestellte Ausnahmebehandlungsfunktion EXC_AVM2 in der Ausnahmebehandlungsregistrierungskette durch das Ablaufverfolgungsmodul AVM zu registrieren, bevor die ursprüngliche Ausnahmebehandlungsfunktion aufgerufen wird. Dies hat zur Folge, dass bei einer durch die ursprünglichen Ausnahmebehandlungsfunktion veranlassten Abwicklung die Ausnahmebehandlungsfunktion EXC_AVM2 aufgerufen wird, die eine entsprechende Abwicklung des Hilfsstapels bewirkt. The situation is different in case (b) when an original exception handler function is invoked indirectly via the exception handling function EXC_AVM registered in the exception handling enrollment chain. If this original exception handling function causes the call stack to be handled, the EXC_AVM exception handling function registered in the exception handler registration chain is not called again because the original exception handler assumes that it is itself registered in the corresponding entry in the exception handling enrollment chain and is not aware of the registration of the EXC_AVM exception handling function this entry has. Therefore, in case (b), the call stack would be handled and the execution of the program resumed at a location provided by the original exception handling function without the auxiliary stack being appropriately handled. To prevent this, a preferred embodiment of the present invention provides for registering another exception handling function EXC_AVM2 provided by the trace module AVM in the exception handling registration chain by the trace module AVM before calling the original exception handling function. As a result, in a transaction initiated by the original exception handling function, the exception handling function EXC_AVM2 is called, which effects a corresponding execution of the auxiliary stack.

7 illustriert ein Beispiel für die Behandlung von Ausnahmen, die während des Ablaufs eines für eine Ablaufverfolgung durch das Ablaufverfolgungsmodul AVM dynamisch instrumentierten Unterprogramms auftreten, gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung. 7 11 illustrates an example of handling exceptions that occur during the course of a subroutine dynamically instrumented for tracing by the trace module AVM, in accordance with a preferred embodiment of the present invention.

Schritt 710 bezeichnet die Ausführung eines Unterprogramms UPX, das für die Ablaufverfolgung durch das Ablaufverfolgungsmodul AVM dynamisch instrumentiert worden ist. Zudem wurde entsprechend der obigen Beschreibung eine Ausnahmebehandlungsfunktion EXC_AVM des Ablaufverfolgungsmoduls AVM registriert. In Schritt 715 wird festgestellt, dass eine Ausnahme vorliegt, die nicht innerhalb des Unterprogramms UPX bzw. durch eine von dem Unterprogramm UPX bereitgestellte Ausnahmebehandlungsfunktion EXC_UPX erfolgreich behandelt werden kann. In Schritt 720 wird daraufhin die von dem Ablaufverfolgungsmodul AVM registrierte Ausnahmebehandlungsfunktion EXC_AVM aufgerufen. Die Ausnahmebehandlungsfunktion EXC_AVM wiederum veranlasst in Schritt 725 eine Registrierung einer weiteren vom Ablaufverfolgungsmodul AVM bereitgestellten Ausnahmebehandlungsfunktion EXC_AVM2 und in Schritt 730 den Aufruf der ursprünglichen von dem aktiven Unterprogramm UPV bereitgestellten Ausnahmebehandlungsfunktion EXC_UPV. In Schritt 735 wird festgestellt, ob und mit welcher Konsequenz die Ausnahmebehandlungsfunktion EXC_UPV die vorliegende Ausnahme behandeln kann.step 710 denotes the execution of a subroutine UPX that has been dynamically instrumented for tracing by the trace module AVM. In addition, according to the above description, an exception handling function EXC_AVM of the trace module AVM was registered. In step 715 it is determined that there is an exception that can not be successfully handled within the subroutine UPX or by an exception handling function EXC_UPX provided by the subroutine UPX. In step 720 Thereafter, the exception handling function EXC_AVM registered by the trace module AVM is called. The exception handling function EXC_AVM in turn causes in step 725 registration of another exception handling function EXC_AVM2 provided by the trace module AVM, and in step 730 the call of the original exception handling function EXC_UPV provided by the active subroutine UPV. In step 735 it is determined whether and with what consequence the exception handling function EXC_UPV can handle the present exception.

Ist die Ausnahmebehandlungsfunktion EXC_UPV in der Lage, die aufgetretene Ausnahme so zu behandeln, dass eine Rückkehr zum Unterprogramm UPX möglich ist, behandelt die Ausnahmebehandlungsfunktion EXC_UPV die Ausnahme dementsprechend in Schritt 740. Daraufhin wird in Schritt 745 die Ausnahmebehandlungsfunktion EXC_AVM2 deregistriert und in Schritt 750 die Abarbeitung des Unterprogramms UPX wieder an der Stelle aufgenommen, an der die Ausnahme aufgetreten ist.If the exception handling function EXC_UPV is able to handle the exception that has occurred in such a way that a return to the subprogram UPX is possible, then the exception handling function EXC_UPV treats the exception accordingly in step 740 , Then in step 745 the exception handling function EXC_AVM2 is deregistered and in step 750 the processing of the UPX subroutine is resumed at the point at which the exception occurred.

Ist die Ausnahmebehandlungsfunktion EXC_UPV in der Lage, die aufgetretene Ausnahme so zu behandeln, dass eine Abwicklung des Aufrufstapels erforderlich wird, wird in Schritt 755 die Abwicklung durch die Ausnahmebehandlungsfunktion EXC_UPV veranlasst. Dies hat zur Folge, dass in Schritt 760 die Ausnahmebehandlungsfunktion EXC_AVM2 aufgerufen wird, da sie dem obersten Eintrag in der Ausnahmebehandlungsregistrierungskette entspricht. Durch die Ausnahmebehandlungsfunktion EXC_AVM2 werden in Schritt 765 die im Zusammenhang mit dem Unterprogramm UPX sowie ggf. weiteren aktiven, von der Abwicklung betroffenen Unterprogrammen vorgenommenen Einträge im Hilfsstapelspeicher gelöscht und damit der dem Unterprogramm UPX zugeordnete Hilfsrahmen im Hilfsstapelspeicher abgewickelt. Die Ausnahmebehandlungsfunktion EXC_AVM2 kann dabei auch veranlassen, dass die Abwicklung registriert bzw. protokolliert wird. In Schritt 770 wird auch der Aufrufrahmen des Unterprogramms UPX abgewickelt. In Schritt 780 wird die Programmabarbeitung an einer Stelle im Unterprogramm UPV wieder aufgenommen.If the exception handling function EXC_UPV is able to handle the occurred exception in such a way that a processing of the call stack becomes necessary, then in step 755 the settlement is initiated by the exception handling function EXC_UPV. As a result, in step 760 exception handling function EXC_AVM2 is called because it corresponds to the top entry in the exception handling registration chain. The exception handling function EXC_AVM2 becomes in step 765 the entries made in the auxiliary stack in connection with the subroutine UPX and optionally further active subprograms affected by the execution are deleted and thus the auxiliary frame assigned to the subprogram UPX is processed in the auxiliary stack. The exception handling function EXC_AVM2 can also cause the processing to be registered or logged. In step 770 The call frame of the UPX subroutine is also handled. In step 780 the program execution is resumed at one point in the UPV subroutine.

Ist die Ausnahmebehandlungsfunktion EXC_UPV nicht in der Lage, die aufgetretene Ausnahme erfolgreich zu behandeln, wird zur Ausnahmebehandlungsfunktion EXC_AVM zurückgekehrt, die die Deregistrierung der Ausnahmebehandlungsfunktion EXC_AVM2 veranlasst und die Kontrolle an das System zurückgibt. Es wird dann die nächste Ausnahmebehandlungsfunktion entsprechend dem nächsten Eintrag in der Ausnahmebehandlungsregistrierungskette aufgerufen und überprüft, ob diese den aufgetretenen Fehler behandeln kann.If the EXC_UPV exception handling function fails to handle the exception that has occurred successfully, it returns to the EXC_AVM exception handling function, which causes deregistration of the EXC_AVM2 exception handler function and returns control to the system. It then calls the next exception handler according to the next entry in the exception handling registration chain and checks if it can handle the error that has occurred.

Den Ausnahmebehandlungsfunktionen kann dabei durch Setzen eines Abwicklungsflags AW mitgeteilt werden, dass es sich nicht mehr um die Phase des Suchens nach einer geeigneten Ausnahmebehandlungsfunktion handelt, sondern eine Abwicklung der jeweiligen Aufrufrahmen und Hilfsrahmen stattfinden soll.The exception handling functions can be informed by setting a handling flag AW that it is no longer the phase of searching for a suitable exception handling function but a handling the respective call frame and subframe.

8 zeigt die verschiedenen Komponenten eines Ablaufverfolgungsmoduls AVM gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung. Das Ablaufverfolgungsmodul AVM 800 weist ein Instrumentierungsmodul 810 auf, das die im Zusammenhang mit 3b näher erläuterte Instrumentierung eines zu verfolgenden Unterprogramms vornimmt. Die weiteren Module 820, 830, 840, 850 nehmen die eigentliche Ablaufverfolgung vor, die im Zusammenhang mit den 3b bis 7 näher beschrieben worden ist. Modul 820 stellt die weiter oben beschriebene Eintrittsprotokollfunktion ER bereit. Modul 830 stellt die weiter oben beschriebene Austrittsprotokollfunktion AR bereit. Modul 840 stellt die weiter oben beschriebene Ausnahmebehandlungsfunktion EXC_AVM bereit. Modul 850 stellt die weiter oben beschriebene weitere Ausnahmebehandlungsfunktion EXC_AVM2 bereit. 8th shows the various components of a trace module AVM according to a preferred embodiment of the present invention. The trace module AVM 800 has an instrumentation module 810 on that related to 3b detailed instrumentation of a sub-program to be followed. The other modules 820 . 830 . 840 . 850 do the actual tracing associated with the 3b to 7 has been described in detail. module 820 provides the entry protocol function ER described above. module 830 provides the exit log function AR described above. module 840 provides the exception handling function EXC_AVM described above. module 850 provides the further exception handling function EXC_AVM2 described above.

Bevorzugterweise umfasst das Ablaufverfolgungsmodul 800 auch ein Zentralmodul 890, das den Einsatz der Module 820, 830, 840 und 850 steuert. In dieser bevorzugten Ausführungsform lenkt eine durch die Instrumentierung eingebrachte Sprunganweisung den Kontrollfluss zuerst zu dem Zentralmodul 890, bevor dieses die in den 3 bis 4 beschriebene Ersetzung der Rücksprungadresse der instrumentierten Unterfunktion veranlasst und dann die Eintrittsprotokollfunktion ER des Moduls 820 aufruft. Zudem kann das Zentralmodul 890 auch die Registrierung der im Modul 850 bereitgestellten Ausnahmebehandlungsfunktion EXC_AVM veranlassen. Nach Beendigung des zu verfolgenden Unterprogramms wird der Kontrollfluss durch die Rücksprungadresse wieder zu dem Zentralmodul 890 umgelenkt, das dann die Protokollierung des Austritts aus dem Unterprogramm durch die im Modul 830 bereitgestellte Austrittsprotokollfunktion AR veranlasst. Zudem kann das oben beschriebene Zusammenspiel der Ausnahmebehandlungsfunktion EXC_AVM in Modul 840 mit der Ausnahmebehandlungsfunktion EXC_AVM2 in Modul 850 durch das Zentralmodul 890 gesteuert sein.Preferably, the trace module comprises 800 also a central module 890 that the use of the modules 820 . 830 . 840 and 850 controls. In this preferred embodiment, a jump instruction introduced by the instrumentation directs the control flow first to the central module 890 before this in the 3 to 4 described replacement of the return address of the instrumented subfunction and then the entry protocol function ER of the module 820 calls. In addition, the central module 890 also the registration of the module 850 cause the exception handling function EXC_AVM to be provided. After completion of the subroutine to be followed, the control flow through the return address becomes the central module again 890 then the logging of the exit from the subroutine by the module 830 provided exit log function AR. In addition, the above-described interaction of the exception handling function EXC_AVM in module 840 with the exception handling function EXC_AVM2 in module 850 through the central module 890 be controlled.

Die vorliegende Erfindung kann sowohl im Nutzermodus als auch im Betriebssystemkernmodus implementiert werden. In 9 wird beispielsweise die Ablaufverfolgung für Prozesse im Nutzermodus gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung dargestellt. Mit Hilfe einer Managementanwendung 910, die in den Arbeitsspeicher des Computersystems geladen wird, werden einem Nutzer Anwendungen bzw. Unterprogramme wie z. B. EXE- oder DLL-Module 930 angezeigt, die gegenwärtig auf dem Computersystem mit Hilfe des Betriebssystemkerns laufen und für die dynamische Aktivierung einer Ablaufverfolgung geeignet sind. Der Nutzer wählt daraufhin ein oder mehrere Anwendungen bzw. Unterprogramme zur Ablaufverfolgung aus. Die Managementanwendung 910 kommuniziert dies dem Ablaufverfolgungsmodul AVM 920, das daraufhin die zu verfolgenden Anwendungen bzw. Unterprogramme wie oben beschrieben instrumentiert. Die Managementanwendung 910 kommuniziert dabei mit dem Ablaufverfolgungsmodul AVM 920, welches z. B. mit Hilfe einer Bibliothekinjektionstechnik in den Arbeitsspeicher eingebracht worden ist, unter Nutzung eines entsprechenden Interprozesskommunikationsmechanismus IPC. Bei Aufruf einer instrumentierten Anwendung bzw. eines instrumentierten Unterprogramms 930 wird deren Ablauf durch das Ablaufverfolgungsmodul AVM 920 wie oben beschrieben verfolgt.The present invention may be implemented in both user mode and kernel operating mode. In 9 For example, tracing is shown for user mode processes in accordance with a preferred embodiment of the present invention. With the help of a management application 910 , which is loaded into the main memory of the computer system, are a user applications or sub-programs such. B. EXE or DLL modules 930 currently running on the computer system using the kernel and are suitable for dynamic activation of a trace. The user then selects one or more applications or subroutines for tracing. The management application 910 this communicates to the trace module AVM 920 , which then instrumented the applications or subroutines to be followed as described above. The management application 910 communicates with the trace module AVM 920 which z. B. has been introduced by means of a library injection technique in the main memory, using a corresponding inter-process communication mechanism IPC. When calling an instrumented application or instrumented subroutine 930 its flow through the trace module AVM 920 tracked as described above.

Um das Arbeiten mit Funktionsnamen (anstatt Adressen) zu ermöglichen, kann die Managementanwendung 910 bevorzugterweise auf eine Datenbank 940 zurückgreifen, die Debug-Symbolinformationen enthält, die eine Übersetzung zwischen Namen und Adressen erlauben.To enable working with function names (rather than addresses), the management application can 910 preferably to a database 940 which contains debug symbol information allowing translation between names and addresses.

10 zeigt schematisch die Ablaufverfolgung im Betriebssystemkernmodus gemäß einer bevorzugten Ausführungsform der vorliegenden Erfindung. Im Falle der Ablaufverfolgung im Betriebssystemkern kommuniziert die Managementanwendung 1010 mittels einer IOCTL-Schnittstelle mit dem Ablaufverfolgungsmodul AVM 1020, welches bei Bedarf als spezieller Gerätetreiber geladen wird und im Betriebssystemkernmodus ausgeführt wird. Die Managementanwendung zeigt einem Nutzer Betriebssystemkernmodule 1030 wie z. B. Gerätetreiber an, die für eine dynamische Aktivierung einer Ablaufverfolgung durch das Ablaufverfolgungsmodul AVM 1020 geeignet sind. Der Nutzer kann daraufhin einen oder mehrere Unterprogramme, d. h. Betriebssystemkernmodule 1030 zur Ablaufverfolgung auswählen. Das Ablaufverfolgungsmodul 1010 instrumentiert daraufhin die ausgewählten Betriebssystemkernmodule 1030 mit Hilfe des Betriebssystemkerns und verfolgt deren Ablauf wie oben beschrieben. Um das Arbeiten mit Funktionsnamen (anstatt Adressen) zu ermöglichen, kann die Managementanwendung 1010 bevorzugterweise auf eine Datenbank 1040 zurückgreifen, die Debug-Symbolinformationen enthält, die eine Übersetzung zwischen Namen und Adressen erlauben. 10 schematically shows the trace in operating system kernel mode according to a preferred embodiment of the present invention. In the case of tracing in the kernel, the management application communicates 1010 by means of an IOCTL interface with the trace module AVM 1020 which is loaded as a special device driver when needed and runs in kernel mode. The management application shows operating system kernel modules to a user 1030 such as For example, device drivers are required for dynamic activation of a trace by the trace module AVM 1020 are suitable. The user can then one or more subroutines, ie operating system kernel modules 1030 to trace. The trace module 1010 then orchestrates the selected operating system kernel modules 1030 with the help of the operating system kernel and follows their procedure as described above. To enable working with function names (rather than addresses), the management application can 1010 preferably to a database 1040 which contains debug symbol information allowing translation between names and addresses.

Soll eine wie oben beschriebene dynamisch aktivierte Ablaufverfolgung beendet werden, müssen alle mit Hilfe des Ablaufverfolgungsmoduls AVM durchgeführten Änderungen rückgängig gemacht werden. Soll darüber hinaus das Ablaufverfolgungsmodul AVM als Ganzes sicher entfernt werden, muss sichergestellt werden, dass alle ablaufverfolgten Unterprogramme beendet wurden und kein Sprung mehr zu dem Ablaufverfolgungsmodul AVM aussteht. Dazu kann es notwendig sein, sämtliche erstellten Hilfsstapelspeicher zu untersuchen. Eine sichere Entfernung des Ablaufverfolgungsmoduls AVM ist erst dann möglich, wenn alle Speicher leer sind, d. h. keine Einträge mehr beinhalten und somit keine Sprünge zum Ablaufverfolgungsmodul AVM mehr ausstehen.If a dynamically activated trace as described above is to be ended, all changes made with the aid of the trace module AVM must be reversed. In addition, if the trace module AVM as a whole is to be safely removed, it must be ensured that all run-track subroutines have been terminated and no longer jump to the trace module AVM pending. For this it may be necessary to examine all created auxiliary stacks. A safe removal of the trace module AVM is only possible when all memory is empty, ie no longer contain entries and thus no more jumps to the trace module AVM longer.

Die vorliegende Erfindung ermöglicht eine dynamische Aktivierung einer Ablaufverfolgung von Unterprogrammen, die sich bereits im Hauptspeicher eines Computersystems befinden. Bevorzugte Ausführungsformen der vorliegenden Erfindung ermöglichen die Registrierung des Eintritts in ein Unterprogramm, des Austritts aus diesem Unterprogramm sowie der Abwicklung eines dem Unterprogramm zugeordneten Aufrufrahmens im Falle einer nicht-regulären Beendigung des Unterprogramms aufgrund des Auftretens einer nicht behandelbaren Ausnahme.The present invention enables dynamic activation of a trace of subroutines already residing in the main memory of a computer system. Preferred embodiments of the present invention allow the registration of the entry into a subroutine, the exit from this subroutine as well as the handling of a call frame associated with the subroutine in the event of a non-regular termination of the subroutine due to the occurrence of an unhandleable exception.

Ein derartige erfindungsgemäße dynamisch aktivierbare Ablaufverfolgung bietet zahlreiche Vorteile. Im folgenden sind nur einige Anwendungsbeispiele genannt:

  • (a) Auf einem Multi-User-System (bspw. Microsoft Windows Terminal Server) dauert der Aufruf von Webseiten ungewöhnlich lange: Es verstreichen mehrere Sekunden, bevor der Aufbau der jeweiligen Webseite im Browser beginnt. Da mehrere Benutzer auf dem System arbeiten, sollte die Analyse des Fehlers keine Unterbrechung des Betriebs (etwa durch Systemneustart) erfordern. Die Analyse eines derartigen Fehlverhaltens könnte wie folgt ablaufen: Zunächst wird mithilfe einer erfindungsgemäßen dynamisch aktivierbaren Ablaufverfolgung der Browser so instrumentiert, dass alle Systemaufrufe (inklusive deren Ausführungszeiten) protokolliert werden. Die Analyse des Protokolls ergibt, dass ein bestimmter Systemaufruf überdurchschnittlich lange dauert – wobei es sich um einen IOCTL (NtDeviceloControlFile) handelt. Die Betrachtung des Aufrufstapels, welcher zu diesem Aufruf führte, ergibt, dass der IOCTL von der DNS-Bibliothek initiiert wurde. Ausgehend von dieser Information werden nun die DNS-Einstellungen und die Verfügbarkeit der DNS-Servers geprüft, was zu der Erkenntnis führt, das der sekundäre DNS-Server zwar erreichbar ist, ein Verbindungsversuch zum primären DNS-Server jedoch stets zu einem Timeout führt. Ein Tausch von primärem und sekundärem DNS-Server behebt das ursprüngliche Problem.
  • (b) Ein System wurde von einer neuartigen Schadware befallen, deren Funktionsweise noch unbekannt ist. Um ein entsprechendes Erkennungs- oder Beseitigungs-Werkzeug erstellen zu können, gilt es daher zunächst, das Verhalten der Schadware zu analysieren. Hierzu kann ein Vergleich zwischen einem unbefallenem und einem befallenem System vorgenommen werden: Zwei identische Computersysteme, wovon eines der Systeme mit der Schadware infiziert worden ist, werden mithilfe einer erfindungsgemäßen dynamisch aktivierbaren Ablaufverfolgung derart instrumentiert, dass die Abläufe im System detailliert protokolliert werden. Nachdem auf beiden Systemen die gleichen Aktionen durchgeführt worden sind, kann durch Vergleich der Protokolle ermittelt werden, wie und in welchem Ausmaß die Schadware das Verhalten beeinflusst hat.
  • (c) Um automatisch Schadware erkennen zu können, muss eine Sicherheitssoftware bestimmte Vorgänge im Betriebssystem auf verdächtige Aktionen hin überwachen: Werden bspw. kritische Systemeinstellungen geändert, so kann die Sicherheitssoftware zunächst überprüfen, ob es sich bei dem durchführenden Programm um Schadware oder unverdächtige Software handelt. Mithilfe einer erfindungsgemäßen dynamisch aktivierbaren Ablaufverfolgung kann eine Sicherheitssoftware beispielsweise den Aufruf bestimmter Funktionen in Bibliotheken oder im Betriebssystemkern überwachen und ggf. protokollieren, um eine solche Überprüfung durchzuführen. Sobald ein Verdacht vorliegt, dass es sich bei einem Programm um Schadware handelt, kann der Benutzer gewarnt werden oder es können konkrete Aktionen – beispielsweise das Terminieren des verdächtigten Programms – veranlasst werden.
  • (d) Ein Entwickler eines Programms, etwa einer Anwendung oder eines Gerätetreibers, möchte den Code auf Ressourcen-Lecks (z. B. Speicher und Handles) überprüfen. Statt der manuellen Instrumentierung des Codes kann hierzu eine erfindungsgemäße dynamisch aktivierbare Ablaufverfolgung eingesetzt werden, um alle Aufrufe von Ressourcen-Akquisitions- sowie Freigabe-Funktionen zu protokollieren. Nach erfolgter Ausführung der zu untersuchenden Anwendung kann somit auf Basis des Protokolls ermittelt werden, welche Ressourcen akquiriert, jedoch nicht freigegeben wurden, also ein Leck darstellen. Statt den gesamten Code auf Lecks zu untersuchen, kann der Entwickler ausgehend von diesem Ergebnis die Analyse so auf jene Code-Stellen beschränken, welche sich mit den betroffenen Ressourcen befassen.
  • (e) Um ein Verständnis für ein System oder eine bestimmte Funktion eines Systems aufzubauen, kann eine visuelle Darstellung des Verhaltens – etwa in Form von UML Sequenz-Diagrammen oder Aufruf-Graphen – dienlich sein. Eine erfindungsgemäße dynamisch aktivierbare Ablaufverfolgung kann genutzt werden, um die zu einer derartigen Visualisierung benötigten Daten zu gewinnen. Typischerweise möchte man zu einem Zeitpunkt nur bestimmte Aspekte eines Systems untersuchen, nicht das Gesamtsystem. Eine erfindungsgemäße Ablaufverfolgung ermöglicht genau diesen Sachverhalt durch die Fähigkeit zur Laufzeit die Ablaufverfolgung für ausgewählte Bereiche des Systems an- bzw. abzuschalten. Als Beispiel sei ein Web-Browser als System gegeben, von dem man wissen möchte, welche Funktionen daran beteiligt sind, eine Web-Seite zu laden und anzuzeigen. Um das herauszufinden, wird die Ablaufverfolgung für alle Funktionen des Browsers aktiviert, eine Web-Seite geladen und die Ablaufverfolgung wieder deaktiviert. Die aufgezeichneten Daten beschreiben nun den Kontrollfluss durch das System, der notwendig war, um die Web-Seite zu laden und anzuzeigen. Im Weiteren kann die Ablaufverfolgung nun so eingegrenzt werden, dass nur diejenigen Funktionen instrumentiert werden, die beispielsweise für die Netzwerkkommunikation notwendig sind.
Such a dynamically activatable trace according to the invention offers numerous advantages. The following are just a few application examples:
  • (a) On a multi-user system (for example, Microsoft Windows Terminal Server), it takes an unusually long time to access web pages: several seconds elapse before the web page starts to build in the browser. Because multiple users are working on the system, the analysis of the error should not require any interruption of operation (such as system reboot). The analysis of such a misconduct could proceed as follows: First, the browser is instrumented using a dynamically activatable trace according to the invention so that all system calls (including their execution times) are logged. The analysis of the log shows that a particular system call takes a longer than average time - which is an IOCTL (NtDeviceloControlFile). Considering the call stack that resulted in this call indicates that the IOCTL was initiated by the DNS library. Based on this information, the DNS settings and the availability of the DNS servers are now checked, which leads to the realization that the secondary DNS server is reachable, but a connection attempt to the primary DNS server always results in a timeout. An exchange of primary and secondary DNS server fixes the original problem.
  • (b) A system has been attacked by a novel malware whose operation is still unknown. In order to be able to create a corresponding detection or removal tool, it is therefore necessary first to analyze the behavior of the damaged product. For this purpose, a comparison can be made between an untrained and an infested system: Two identical computer systems, of which one of the systems has been infected with the damaged goods, are instrumented by means of a dynamically activatable trace according to the invention in such a way that the processes in the system are logged in detail. After the same actions have been taken on both systems, it can be determined by comparing the logs how and to what extent the malware affected the behavior.
  • (c) To automatically detect malware, security software must monitor certain operations in the operating system for suspicious actions: For example, if critical system settings are changed, the security software can first verify that the executing program is malware or unsuspected software , By means of a dynamically activatable trace according to the invention, a security software can monitor, for example, the call of certain functions in libraries or in the operating system kernel and, if necessary, log to carry out such a check. Once suspected that a program is malware, the user can be warned or specific actions can be taken, such as scheduling the suspected program.
  • (d) A developer of a program, such as an application or device driver, wants to check the code for resource leaks (eg, memory and handles). Instead of the manual instrumentation of the code, a dynamically activatable trace according to the invention can be used for this purpose in order to log all calls of resource acquisition and release functions. After the execution of the application to be examined can thus be determined on the basis of the protocol, which resources were acquired, but were not released, so represent a leak. Instead of examining the entire code for leaks, based on this result, the developer can limit the analysis to those code locations that deal with the resources involved.
  • (e) To build an understanding of a system or a particular function of a system, a visual representation of the behavior, such as UML sequence diagrams or invocation graphs, may be useful. A dynamically activatable trace according to the invention can be used to obtain the data required for such a visualization. Typically, one would like to examine only certain aspects of a system at a time, not the entire system. A tracing according to the invention enables precisely this state of affairs through the ability to Run time to turn tracing on or off for selected areas of the system. As an example, consider a web browser as a system that you want to know about which functions are involved in loading and displaying a web page. To find out, the trace is enabled for all features of the browser, a web page is loaded and the trace is disabled again. The recorded data now describes the control flow through the system that was necessary to load and display the web page. Furthermore, the trace can now be limited so that only those functions are instrumented that are necessary, for example, for network communication.

Die vorliegende Erfindung wurde mit Bezug auf mit ihr übereinstimmende bevorzugte technische Ausführungsformen beschrieben. Es ist für den einschlägigen Fachmann offensichtlich, dass verschiedene Modifikationen, Variationen und Verbesserungen der vorliegenden Erfindung angesichts der obigen Lehre innerhalb des Bereichs der angefügten Ansprüche durchgeführt werden können, ohne von dem Grundgedanken und dem angestrebten Schutzbereich der Erfindung abzuweichen. Dementsprechend wird festgestellt, dass die Erfindung nicht durch spezielle anschauliche Ausführungsformen beschränkt ist, sondern lediglich durch den Schutzbereich der Patentansprüche.The present invention has been described with reference to preferred technical embodiments consistent therewith. It will be apparent to those skilled in the art that various modifications, variations and improvements of the present invention may be made in light of the above teachings within the scope of the appended claims without departing from the spirit and intended scope of the invention. Accordingly, it is to be understood that the invention is not limited by any particular illustrative embodiments, but only by the scope of the claims.

ZITATE ENTHALTEN IN DER BESCHREIBUNG QUOTES INCLUDE IN THE DESCRIPTION

Diese Liste der vom Anmelder aufgeführten Dokumente wurde automatisiert erzeugt und ist ausschließlich zur besseren Information des Lesers aufgenommen. Die Liste ist nicht Bestandteil der deutschen Patent- bzw. Gebrauchsmusteranmeldung. Das DPMA übernimmt keinerlei Haftung für etwaige Fehler oder Auslassungen.This list of the documents listed by the applicant has been generated automatically and is included solely for the better information of the reader. The list is not part of the German patent or utility model application. The DPMA assumes no liability for any errors or omissions.

Zitierte PatentliteraturCited patent literature

  • US 7047521 B2 [0006] US 7047521 B2 [0006]

Claims (18)

Verfahren zur dynamischen Aktivierung einer Ablaufverfolgung bezüglich eines auf einem Computersystem, das durch einen Betriebssystemkern betrieben wird, laufenden Unterprogramms, wobei das Unterprogramm eine Vielzahl von Instruktionen umfasst und sich in Maschinencode in einem Arbeitsspeicher des Computersystems befindet und wobei eine dieser Instruktionen oder eine Sequenz dieser Instruktionen eine Leeranweisung darstellt, die in Maschinencode eine Größe aufweist, die mindestens der Größe des Maschinencodes einer Sprunganweisung entspricht, und wobei das Verfahren umfasst: Laden des Maschinencodes eines Ablaufverfolgungsmoduls in den Arbeitsspeicher des Computersystems; Ersetzen des Maschinencodes der Leeranweisung des Unterprogramms in dem Arbeitsspeicher durch den Maschinencode einer Sprunganweisung, die ein Umlenken eines Programmkontrollflusses zu dem Ablaufverfolgungsmodul im Arbeitsspeicher ermöglicht; Umlenken, nach Aufruf des Unterprogramms durch ein aufrufendes Programm, des Programmkontrollflusses zu dem Ablaufverfolgungsmodul durch die Sprunganweisung; Registrieren eines Eintritts in das Unterprogramm durch das Ablaufverfolgungsmodul; und Rückgabe des Programmkontrollflusses an das Unterprogramm.A method of dynamically activating a trace with respect to a subroutine running on a computer system operated by an operating system kernel, the subroutine comprising a plurality of instructions and being located in machine code in a working memory of the computer system and wherein one of these instructions or a sequence of these instructions represents an idle instruction having in machine code a size at least equal to the size of the machine code of a jump instruction, and wherein the method comprises: Loading the machine code of a trace module into the memory of the computer system; Replacing the machine code of the idle instruction of the subroutine in the working memory with the machine code of a jump instruction which enables a redirection of a program control flow to the trace module in the main memory; Upon invoking the subroutine by a calling program, redirecting the program control flow to the trace module by the jump instruction; Registering an entry in the subroutine by the trace module; and Return the program control flow to the subroutine. Verfahren nach Anspruch 1, wobei die Sprunganweisung ein indirektes Umlenken des Programmkontrollflusses zu dem Ablaufverfolgungsmodul indirekt ermöglicht, in dem die Sprunganweisung als Sprungziel eine weitere Sprunganweisung definiert, die sich in einem dem Unterprogramm unmittelbar voranstehenden Pufferbereich befindet und als Sprungziel das Ablaufverfolgungsmodul im Arbeitsspeicher definiert.The method of claim 1, wherein the jump instruction indirectly enables the program control flow to be indirectly redirected to the trace module, in which the jump instruction defines as a jump target a further jump instruction which is in a buffer area immediately preceding the subroutine and defines the trace module in memory as a jump target. Verfahren nach Anspruch 2, wobei der Betriebssystemkern einem Windows NT Betriebssystemkern für IA-32, die Sprunganweisung einer 2 Byte umfassenden Kurzsprunganweisung und die weitere Sprunganweisung einer 5 Byte umfassenden Langsprunganweisung entspricht.The method of claim 2, wherein the operating system kernel corresponds to a Windows NT kernel for IA-32, the jump instruction of a 2 byte short jump instruction and the further jump instruction of a 5 byte long jump instruction. Verfahren nach Anspruch 1, wobei die Sprunganweisung ein direktes Umlenken des Programmkontrollflusses zu dem Ablaufverfolgungsmodul ermöglicht, in dem die Sprunganweisung als Sprungziel das Ablaufverfolgungsmodul definiert.The method of claim 1, wherein the jump instruction enables a direct redirection of the program control flow to the trace module, in which the jump instruction defines the trace module as a jump target. Verfahren nach einem der Ansprüche 1 bis 4, wobei die Leeranweisung der ersten Instruktion des Unterprogramms entspricht.The method of one of claims 1 to 4, wherein the idle instruction corresponds to the first instruction of the subroutine. Verfahren nach einem der Ansprüche 1 bis 5, das nach Rückgabe des Programmkontrollflusses an das Unterprogramm weiter umfasst: Abarbeiten der Instruktionen des Unterprogramms bis zum Ende des Unterprogramms; Umlenken des Programmkontrollflusses zu dem Ablaufverfolgungsmodul; Registrieren eines Austritts aus dem Unterprogramm durch das Ablaufverfolgungsmodul; und Rückgabe des Programmkontrollflusses an das aufrufende Programm.Method according to one of claims 1 to 5, which further comprises after returning the program control flow to the subroutine: Processing the instructions of the subroutine until the end of the subroutine; Redirecting the program control flow to the trace module; Registering an exit from the subroutine by the trace module; and Returning the program control flow to the calling program. Verfahren nach Anspruch 6, wobei das Ablaufverfolgungsmodul bei Aufruf des Unterprogramms eine in einem dem Unterprogramm zugeordneten Aufrufrahmen eines Aufrufstapels abgelegte Rücksprungadresse zu dem aufrufenden Programm durch eine Rücksprungadresse zu dem Ablaufverfolgungsmodul ersetzt und der Programmkontrollfluss nach Abarbeiten der Instruktionen des Unterprogramms durch die in dem Aufrufrahmen abgelegte Rücksprungadresse zu dem Ablaufverfolgungsmodul umgelenkt wird.The method of claim 6, wherein the trace module, upon invoking the subroutine, replaces a return address stored in a call stack call frame associated with the subroutine to the calling program by a return address to the trace module, and the program control flow, after executing the instructions of the subroutine, by the return address stored in the call frame is redirected to the trace module. Verfahren nach Anspruch 7, wobei die im Aufrufrahmen ersetzte Rücksprungadresse in einem dem Unterprogramm zugeordneten Hilfsrahmen eines Hilfsstapels abgelegt wird und nach Aufzeichnung des Austritts aus dem Unterprogramm der Programmkontrollfluss durch die in dem Hilfsstapel abgelegte Rücksprungadresse an das aufrufende Programm zurückgegeben wird.Method according to claim 7, wherein the return address replaced in the call frame is stored in an auxiliary frame assigned to the subroutine of an auxiliary stack and after recording the exit from the subroutine the program control flow is returned to the calling program by the return address stored in the auxiliary stack. Verfahren nach Anspruch 7 oder 8, wobei das Ablaufverfolgungsmodul bei Aufruf des Unterprogramms eine Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls registriert und das Verfahren weiter umfasst: Auftreten einer Ausnahme, die nicht innerhalb des Unterprogramms oder durch eine registrierte Ausnahmebehandlungsfunktion des Unterprogramms behandelt werden kann, während der Abarbeitung der Instruktionen des Unterprogramms oder von von dem Unterprogramm aufgerufenen weiteren Unterprogrammen; Aufrufen der registrierten Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls; Aufrufen einer von einem weiteren laufenden Unterprogramm registrierten Ausnahmebehandlungsfunktion; und Registrieren einer Abwicklung des Aufrufrahmens des Unterprogramms mittels der Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls, falls die Behandlung der aufgetretenen Ausnahme durch die von dem weiteren laufenden Unterprogramm registrierte Ausnahmebehandlungsfunktion eine Aufrufstapelabwicklung veranlasst, welche einen dem Unterprogramm zugeordneten Aufrufrahmen des Aufrufstapels betrifft.The method of claim 7 or 8, wherein the trace module registers an exception handling function of the trace module upon invocation of the subroutine and further comprises the method: Occurrence of an exception that can not be handled within the subroutine or by a registered exception handling function of the subroutine while processing the instructions of the subroutine or other subroutines called by the subroutine; Calling the registered exception handling function of the trace module; Calling an exception handling function registered by another running subroutine; and Registering a handling of the call frame of the subroutine by means of the exception handling function of the trace module, if the handling of the exception occurred by the exception handling function registered by the further running subroutine causes call stack handling relating to a call stack associated with the subroutine. Verfahren nach Anspruch 9, wobei das Ablaufverfolgungsmodul bei Aufruf des Unterprogramms die Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls mittels folgender Schritte registriert: Ersetzen der obersten in einer Ausnahmebehandlungsregistrierungskette gespeicherten Adresse einer Ausnahmebehandlungsfunktion durch die Adresse der Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls; und Speichern der ersetzten Adresse in dem dem Unterprogramm zugeordneten Hilfsrahmen. The method of claim 9, wherein the trace module, upon invoking the subroutine, registers the exception handling function of the trace module by the steps of: replacing the topmost address of an exception handling function stored in an exception handler registration chain with the address of the exception handling function of the trace module; and storing the replaced address in the subframe associated subframe. Verfahren nach Anspruch 10, weiter umfassend: Prüfen, vor dem Ersetzen der obersten in der Ausnahmebehandlungsregistrierungskette gespeicherten Adresse, ob die Adresse der Adresse der Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls entspricht, und wenn dies der Fall ist: Identifizieren des Unterprogramms, das die Adresse der Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls in dem obersten Eintrag der Ausnahmebehandlungsregistrierungskette abgespeichert hat, durch Analyse des Hilfsstapels; und Speichern einer Adresse eines Hilfsrahmens, der dem identifizierten Unterprogramm entspricht, in dem Hilfsrahmen des Unterprogramms, bei dem die Ausnahme aufgetreten ist.The method of claim 10, further comprising: Check, before replacing the top address stored in the exception handling registration chain, if the address of the address matches the exception handling function of the trace module, and if so: Identifying the subroutine that has stored the address of the exception handling function address of the trace module in the top entry of the exception handling registration chain by analyzing the auxiliary stack; and Storing an address of a subframe corresponding to the identified subroutine in the subframe of the subroutine in which the exception occurred. Verfahren nach Anspruch 10 oder 11, wobei durch die registrierte Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls vor dem Aufrufen der von dem weiteren laufenden Unterprogramm registrierten Ausnahmebehandlungsfunktion eine weitere Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls in der Ausnahmebehandlungsregistrierungskette als neuer oberster Eintrag registriert wird und der Schritt des Registrierens umfasst: Veranlassen der Aufrufstapelabwicklung durch die von dem weiteren laufenden Unterprogramm registrierte Ausnahmebehandlungsfunktion; Aufrufen der in dem obersten Eintrag der Ausnahmebehandlungsregistrierungskette registrierten weiteren Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls; Abwickeln des dem Unterprogramm zugeordneten Hilfsrahmens des Hilfsstapels sowie gegebenenfalls weiterer gemäß Anspruch 11 mit dem Unterprogramm assoziierten Hilfsrahmen durch die weitere Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls; Abwickeln des dem Unterprogramm zugeordneten Aufrufrahmens des Aufrufstapels durch die von dem weiteren laufenden Unterprogramm registrierte Ausnahmebehandlungsfunktion; wobei das Abwickeln durch die weitere Ausnahmebehandlungsfunktion des Ablaufverfolgungsmoduls registriert wird.A method according to claim 10 or 11, wherein, by the registered exception handler function of the trace module, prior to invoking the exception handler registered by the further running subprogram, a further exception handler function of the trace module is registered as a new top entry in the exception handler register, and the step of registering comprises: Causing the call stack handling by the exception handling function registered by the other running subroutine; Calling the further exception handling function of the trace module registered in the top entry of the exception handling registration chain; Unwinding the sub-program associated sub-frame of the auxiliary stack and possibly further according to claim 11 associated with the sub-sub-frame by the further exception handling function of the trace module; Unwinding the call stack of the call stack associated with the subroutine by the exception handling function registered by the further running subroutine; wherein the unwinding is registered by the further exception handling function of the trace module. Verfahren nach einem der Ansprüche 10 bis 12, bei dem der Betriebssystemkern einem Windows NT Betriebssystemkern für IA-32 entspricht und die Ausnahmebehandlungsregistrierungskette entsprechend der von Windows NT bereitgestellten strukturierten Ausnahmebehandlung implementiert ist.The method of any one of claims 10 to 12, wherein the operating system kernel corresponds to a Windows NT kernel for IA-32 and the exception handler registration chain is implemented according to the structured exception handler provided by Windows NT. Verfahren nach einem der Ansprüche 1 bis 13, wobei ein Eintritt in das Unterprogramm oder ein Austritt aus dem Unterprogramm durch Hoch- bzw. Herunterzählen eines Zählers oder ein zeitliches Aufzeichnen bzw. Protokollieren registriert wird.Method according to one of claims 1 to 13, wherein an entry into the subroutine or an exit from the subroutine by counting up or down a counter or a time recording or logging is registered. Verfahren nach einem der Ansprüche 1 bis 14, bei dem bei Deaktivierung der die dynamisch aktivierte Ablaufverfolgung des Unterprogramms alle von dem Ablaufverfolgungsmodul bezüglich dieses Unterprogramms vorgenommenen Änderungen rückgängig gemacht werden.Method according to one of claims 1 to 14, wherein upon deactivation of the dynamically activated trace of the subroutine, all changes made by the trace module with respect to this subroutine are undone. Verfahren nach einem der Ansprüche 1 bis 14, bei dem vor Entfernung des Ablaufverfolgungsmoduls aus dem Hauptspeicher alle von dem Ablaufverfolgungsmodul veranlassten Änderungen rückgängig gemacht werden und sichergestellt wird, dass keine Rücksprünge zu dem Ablaufverfolgungsmodul mehr ausstehenMethod according to one of Claims 1 to 14, in which, before the removal of the trace module from the main memory, all changes made by the trace module are reversed and it is ensured that no more jumps to the trace module are outstanding Verfahren nach einem der Ansprüche 1 bis 16, wobei eine Managementanwendung mit Hilfe des Betriebssystemkerns auf dem Computersystem laufende Unterprogramme identifiziert, die eine Leeranweisung enthalten, die in Maschinencode eine Größe aufweist, die mindestens der Größe eines Maschinencodes der Sprunganweisung entspricht, und wobei die Managementanwendung die identifizierten Unterprogramme einem Nutzer des Systems zur Auswahl anbietet und in Reaktion auf eine Auswahl des Benutzers das Ablaufverfolgungsmodul anweist, die jeweilige Leeranweisung in dem ausgewählten Unterprogramm bzw. in den ausgewählten Unterprogrammen durch die Sprunganweisung zu ersetzen.The method of any one of claims 1 to 16, wherein a management application using the operating system kernel identifies subprograms running on the computer system that include a void instruction having a size in machine code that is at least the size of a machine code of the vault instruction, and wherein the management application comprises the identifies subroutines to a user of the system for selection and, in response to a selection of the user, instructs the trace module to replace the respective empty instruction in the selected subroutine (s) with the jump instruction. Verfahren nach Anspruch 17, wobei die Managementanwendung die Unterprogramme durch Analyse deren Maschinencodes oder durch Vergleich mit einer Liste von bekannten Unterprogrammen, die eine entsprechende Leeranweisung enthalten, identifiziert.The method of claim 17, wherein the management application identifies the subroutines by analyzing their machine codes or by comparing them with a list of known subroutines containing a corresponding empty instruction.
DE102009038177.5A 2009-08-20 2009-08-20 Tracing in a running computer system Active DE102009038177B4 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
DE102009038177.5A DE102009038177B4 (en) 2009-08-20 2009-08-20 Tracing in a running computer system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
DE102009038177.5A DE102009038177B4 (en) 2009-08-20 2009-08-20 Tracing in a running computer system

Publications (2)

Publication Number Publication Date
DE102009038177A1 true DE102009038177A1 (en) 2011-03-24
DE102009038177B4 DE102009038177B4 (en) 2019-05-23

Family

ID=43603193

Family Applications (1)

Application Number Title Priority Date Filing Date
DE102009038177.5A Active DE102009038177B4 (en) 2009-08-20 2009-08-20 Tracing in a running computer system

Country Status (1)

Country Link
DE (1) DE102009038177B4 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112433945A (en) * 2020-11-26 2021-03-02 百富计算机技术(深圳)有限公司 Method and device for dynamically tracking program and electronic equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7047521B2 (en) 2001-06-07 2006-05-16 Lynoxworks, Inc. Dynamic instrumentation event trace system and methods

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5628016A (en) * 1994-06-15 1997-05-06 Borland International, Inc. Systems and methods and implementing exception handling using exception registration records stored in stack memory
US7512935B1 (en) * 2001-02-28 2009-03-31 Computer Associates Think, Inc. Adding functionality to existing code at exits
US6966057B2 (en) * 2001-03-30 2005-11-15 Intel Corporation Static compilation of instrumentation code for debugging support
US7389494B1 (en) 2003-11-14 2008-06-17 Sun Microsystems, Inc. Mechanism for statically defined trace points with minimal disabled probe effect
US7519944B2 (en) * 2004-11-05 2009-04-14 International Business Machines Corporation Computer method and system for executing post-processing logic depending on function exit type
US20070006167A1 (en) * 2005-05-31 2007-01-04 Chi-Keung Luk Optimizing binary-level instrumentation via instruction scheduling

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7047521B2 (en) 2001-06-07 2006-05-16 Lynoxworks, Inc. Dynamic instrumentation event trace system and methods

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112433945A (en) * 2020-11-26 2021-03-02 百富计算机技术(深圳)有限公司 Method and device for dynamically tracking program and electronic equipment

Also Published As

Publication number Publication date
DE102009038177B4 (en) 2019-05-23

Similar Documents

Publication Publication Date Title
DE60010420T2 (en) Automatic regression testing of workstation software
DE69533005T2 (en) Byte code program interpreter, method and arrangement with pretest of data type restrictions
DE69932371T2 (en) Movable instrumentation tags for testing and troubleshooting a computer program
DE60130840T2 (en) Apparatus and method for cataloging symbolic data for use in performance analysis of computer programs
DE69026379T2 (en) Message-oriented troubleshooting procedures
DE60001916T2 (en) PLATFORM-INDEPENDENT MEMORY IMAGE ANALYSIS ARCHITECTURE FOR PROGRAM ERROR ELIMINATION
DE112011101364B4 (en) Troubleshooting multithreaded code
DE60313652T2 (en) METHOD AND DEVICE FOR CONTROLLING THE CONVERSION OF PROGRAM CODES
DE60002295T2 (en) EFFECTIVE EXCEPTIONAL TREATMENT
DE69814174T2 (en) JAVA RUNTIME SYSTEM WITH CHANGED CONSTANT COLLECTION
DE69909945T2 (en) Method and arrangement for correlating profile data dynamically generated by an optimized executable program with source code instructions
DE60006410T2 (en) METHOD AND SYSTEM FOR DISTRIBUTING OBJECT-ORIENTED COMPUTER PROGRAMS
EP0674784B1 (en) Process for testing at least one class of an object-oriented program on a computer
DE60021066T2 (en) Checking a software package
DE602004006253T2 (en) DEVICES AND METHODS OF RESTORING SYNCHRONIZATION FOR OBJECT-ORIENTED SOFTWARE APPLICATIONS IN MANAGED TIME ENVIRONMENTS
DE10050684A1 (en) Method for periodic trace-sampling follow-up for real-time generation of segments of call stack trees for data processing systems, involves merging all tree-data structures of scanning period when program conclusion notification is received
DE10393968T5 (en) Continuous buffer storage device and method
DE69727177T2 (en) Emulation of asynchronous signals with a branching mechanism
DE602006000728T2 (en) Support of dynamically typed languages in typed assembly languages
US6735774B1 (en) Method and apparatus for system call management
DE10103070B4 (en) Method and test circuit for determining a validity status for a past load command
DE102006040794A1 (en) Software program for implementing testing of e.g. electronic component, has two libraries with respective compiled routine coupled with function call when program is linked and is not linked in mode, respectively
EP1010070B1 (en) Method for converting an object code into a programme code
DE102009038177B4 (en) Tracing in a running computer system
DE102019105418B3 (en) Method for generating a representation of program logic, decompiling device, recompiling system and computer program products

Legal Events

Date Code Title Description
OP8 Request for examination as to paragraph 44 patent law
R016 Response to examination communication
R016 Response to examination communication
R016 Response to examination communication
R016 Response to examination communication
R016 Response to examination communication
R018 Grant decision by examination section/examining division
R020 Patent grant now final