HK40035552B - Execution control with cross-level trace mapping - Google Patents

Execution control with cross-level trace mapping

Info

Publication number
HK40035552B
HK40035552B HK62021024900.4A HK62021024900A HK40035552B HK 40035552 B HK40035552 B HK 40035552B HK 62021024900 A HK62021024900 A HK 62021024900A HK 40035552 B HK40035552 B HK 40035552B
Authority
HK
Hong Kong
Prior art keywords
trace
execution
replay
program
traced
Prior art date
Application number
HK62021024900.4A
Other languages
Chinese (zh)
Other versions
HK40035552A (en
Inventor
尼尔森 P·
戴维斯 J·
迈尔斯 D·
莱 T·
陈 D·
莫拉 J·
福尔克 N·
Original Assignee
微软技术许可有限责任公司
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 微软技术许可有限责任公司 filed Critical 微软技术许可有限责任公司
Publication of HK40035552A publication Critical patent/HK40035552A/en
Publication of HK40035552B publication Critical patent/HK40035552B/en

Links

Description

具有跨级别跟踪映射的执行控制Execution control with cross-level tracing mapping

技术领域Technical Field

本公开的实施例涉及具有跨级别跟踪映射的执行控制。Embodiments of this disclosure relate to execution control with cross-level tracking mapping.

背景技术Background Technology

计算机软件通常很复杂。部分复杂性可能来自于程序被设计为执行的工作的性质,例如,在数小时或更长时间内追踪大量真实世界项或正在进行的事务,与其他复杂软件协调活动,控制复杂硬件,等等。在软件的几乎任何真实世界使用中,复杂性也会出现,因为很多细节被引入并且应当被正确管理以指示计算机硬件如何执行真实世界工作,该真实世界工作在最初用英语或另一种自然语言来描述时精度要小得多。也就是说,从高级别描述到由计算机系统可执行的低级别实现的转换不可避免地引入了复杂性。甚至比自然语言更精确的编程语言源代码仍处于相对高级别,并且因此是模糊的,对各种理解和实现是开放的。源代码被转换为由计算性硬件直接可执行的低级别指令,很多细节被引入,并且在转换期间做出了选择。Computer software is typically complex. Part of this complexity may stem from the nature of the work a program is designed to perform—for example, tracking a large number of real-world items or ongoing transactions over hours or longer, coordinating activities with other complex software, controlling complex hardware, and so on. Complexity also arises in almost any real-world use of software because many details are introduced and must be properly managed to instruct the computer hardware how to perform real-world work that would have been far less precise when initially described in English or another natural language. In other words, the conversion from a high-level description to a low-level implementation executable by a computer system inevitably introduces complexity. Even the source code of programming languages, which are more precise than natural languages, remains at a relatively high level and is therefore ambiguous, open to various interpretations and implementations. As the source code is translated into low-level instructions directly executable by computing hardware, many details are introduced and choices are made during the translation process.

复杂性引入通常经常意识到的编程错误(又称为“缺陷”,bug)的可能性。标识缺陷的原因并且尝试修改程序以补救或移除缺陷的影响的过程被称为“调试”。协助调试的专用软件工具称为“调试器”。被调试的程序称为“调试对象”。Complexity introduces the possibility of commonly recognized programming errors (also known as "defects" or bugs). The process of identifying the cause of a defect and attempting to modify the program to remedy or remove its effects is called "debugging." Specialized software tools that assist in debugging are called "debuggers." The program being debugged is called a "debugging object."

当开发者可以随意缓慢地或全速运行调试对象,或者随意暂停调试对象的执行,并且可以在调试对象的执行的任何时候检查调试对象的所有状态信息时,调试可能是最容易的。这被称为“实时过程调试”。然而,对调试对象的这样的完全访问权通常是不可用的。例如,调试对象可以是生产软件,在不违反服务协议或损害利益方的声誉、安全性或财务状况的情况下,不能够对该生产软件进行实时调试。如果在开发者检查变量值、检查利用哪些参数值调用了哪些函数、查看源代码、考虑缺陷的可能解释、以及设计可能有助于标识、补救或消除缺陷的测试时一次将实时过程调试对象暂停几秒钟,则可能会造成不能够接受的危害。Debugging is often easiest when developers can run a debug object at will, either slowly or at full speed, or pause its execution at will, and can inspect all its state information at any point during its execution. This is known as "real-time process debugging." However, such complete access to a debug object is often unavailable. For example, a debug object might be production software, which cannot be debugged in real-time without violating service agreements or harming the reputation, security, or financial condition of stakeholders. Pausing a real-time process debug object for even a few seconds at a time while a developer examines variable values, checks which functions are called with which parameter values, reviews source code, considers possible interpretations of defects, and designs tests that might help identify, remedy, or eliminate defects could cause unacceptable harm.

因此,有时状态信息在调试对象执行时被记录,以便稍后被检查而基本上不暂停调试对象的执行。创建这样的记录可能会减慢调试对象的速度,但是该记录可以提供有用的信息,而不会像实时调试那样损害生产性能目标。例如,调试对象可以被暂停足够长的时间以创建存储器转储,该存储器转储在特定时间点将与调试器相关的一些或所有存储器值复制到磁盘上。调试对象的执行的一些方面也可以记录在执行跟踪中。在调试对象不是实时过程的情况下,一些调试器支持使用这种跟踪来重放所跟踪的调试对象的执行。利用一些调试器,可以正向或反向重放调试对象执行,从而准许“时间旅行”(time travel)、“反向”或“历史性”调试。Therefore, state information is sometimes logged while the debug object is executing so that it can be examined later without essentially pausing the debug object's execution. Creating such a log may slow down the debug object, but it can provide useful information without compromising production performance goals as much as real-time debugging. For example, the debug object can be paused long enough to create a memory dump that copies some or all memory values associated with the debugger to disk at a specific point in time. Some aspects of the debug object's execution can also be logged in an execution trace. In cases where the debug object is not a real-time process, some debuggers support using such a trace to replay the traced execution of the debug object. Some debuggers allow the debug object's execution to be replayed forward or backward, enabling "time travel," "reverse," or "historical" debugging.

然而,由于执行跟踪包含的信息可以少于实时过程调试期间有时可用的信息,并且由于执行跟踪在低级别记录状态信息,因此当调试器或其他软件工具尝试控制重放执行(即,基于所记录的跟踪的执行)时会出现技术挑战。依赖于实现,开发者熟悉的并且经常在实时调试期间使用的执行控制操作当在基于跟踪的重放期间尝试时可能不太准确,或者可能根本不可用。However, because execution traces may contain less information than is sometimes available during real-time process debugging, and because they record state information at a low level, technical challenges arise when debuggers or other software tools attempt to control replay execution (i.e., execution based on the recorded trace). Depending on the implementation, execution control operations that developers are familiar with and frequently use during real-time debugging may be less accurate or simply unavailable when attempted during trace-based replay.

因此,通过调试器或其他重放或日志记录工具,使用低级别执行跟踪来有效且准确地实现高级别执行控制的进步可以帮助改善开发者或自动化性能监测工具可用的信息。因此,这样的进步将倾向于通过支持对计算机系统行为的准确理解并且通过支持减轻或消除计算机系统缺陷来改善计算机系统的功能。Therefore, advancements in using low-level execution tracing to effectively and accurately achieve high-level execution control through debuggers or other replay or logging tools can help improve the information available to developers or automated performance monitoring tools. Consequently, such advancements will tend to improve the functionality of computer systems by supporting a more accurate understanding of their behavior and by enabling the mitigation or elimination of system defects.

发明内容Summary of the Invention

本文中描述的一些技术涉及在程序的源代码中的位置与程序的执行的跟踪中的对应位置之间进行映射的技术活动,从而提高了在基于跟踪的调试中的执行控制的准确性。一些教导涉及特定断点设置过程(procedure),该过程在与源代码表达式或语句对准的位置处设置一个或多个断点。用于适配实时调试环境以支持基于跟踪的反向执行的技术机制被描述。响应于基于执行跟踪向前或反向或向前和反向重放调试对象执行的挑战,特定的技术工具和技术在此被描述。与本文中的教导有关的其他技术活动对于本领域技术人员也将变得很清楚。Some of the techniques described herein involve mapping locations in the program's source code to corresponding locations in the program's execution tracing, thereby improving the accuracy of execution control in tracing-based debugging. Some teachings involve specific breakpoint setting procedures that set one or more breakpoints at locations aligned with source code expressions or statements. Technical mechanisms for adapting to real-time debugging environments to support tracing-based reverse execution are described. Specific technical tools and techniques are described herein in response to the challenges of replaying debug object execution forward or backward or both forward and backward based on execution tracing. Other technical activities related to the teachings herein will also become apparent to those skilled in the art.

本文所述的一些实施例使用或提供跟踪重放执行控制能力,其使用处理器、存储器、在使用运行时的程序的执行期间所记录的跟踪、程序源代码、源代码和其中间表示和跟踪之间的映射、以及调试器或其他工具中的执行控制器。运行时包含支持代码,代码随所跟踪的程序被执行以及跟踪被捕获而提供动态编译或存储器垃圾收集服务。跟踪可以包括由程序执行的本机代码指令的记录。跟踪可以包括在调试对象正在被执行的同时在程序的执行期间所访问的数据的记录。跟踪可以包括一个或多个存储器转储或快照。跟踪可以被存储在非易失性或易失性存储器的一个或多个文件或部分中。执行控制器被配置为响应于来自工具的请求而控制跟踪的重放执行。在重放期间,使用被设置为帮助将所分组的本机指令与其对应的相应源代码项进行对准的断点,源代码与跟踪本机代码指令或其他跟踪条目通过源中间映射和中间本机映射得以相关联。Some embodiments described herein use or provide trace replay execution control capabilities that utilize a processor, memory, traces recorded during the execution of a program at runtime, program source code, mappings between source code and its intermediate representations and traces, and an execution controller in a debugger or other tool. The runtime contains supporting code that provides dynamic compilation or memory garbage collection services as the traced program is executed and the trace is captured. A trace may include a record of native code instructions executed by the program. A trace may include a record of data accessed during program execution while the debug object is being executed. A trace may include one or more memory dumps or snapshots. A trace may be stored in one or more files or portions of non-volatile or volatile memory. The execution controller is configured to control the replay execution of the trace in response to a request from a tool. During replay, breakpoints configured to help align grouped native instructions with their corresponding source code entries are used, with the source code and trace native code instructions or other trace entries associated through source intermediate mappings and intermediate native mappings.

本文所述的一些实施例使用或执行计算机实现的跟踪重放执行控制。所跟踪的被管理程序被标识。被管理程序(也称为“运行时管理”程序)是一种被配置为结合对运行时的调用而执行的程序。所跟踪的被管理程序是一个被跟踪或被配置为要被跟踪的程序。在软件工具中接收跟踪重放执行控制请求。基于跟踪重放执行控制请求,在所跟踪的被管理程序的源代码与该源代码的中间表示之间进行映射,并且在该中间表示与跟踪之间进行另一映射。跟踪不包括运行时的任何执行实例。通过例如在与跟踪重放执行控制请求相对应的方向和数量上仿真模拟跟踪活动(例如,向前一步,或者通过对其步进跳过(step over)来重复整个例程),或者通过在跟踪位置上设置断点,或者通过执行上述两者,跟踪的重放可以被控制。Some embodiments described herein use or perform computer-implemented trace replay execution control. The managed program being traced is identified. A managed program (also called a “runtime management” program) is a program configured to execute in conjunction with calls to the runtime. The managed program being traced is a program that is being traced or configured to be traced. A trace replay execution control request is received in a software tool. Based on the trace replay execution control request, a mapping is made between the source code of the managed program being traced and an intermediate representation of that source code, and another mapping is made between that intermediate representation and the trace. The trace does not include any execution instances of the runtime. Replay of the trace can be controlled by, for example, simulating the trace activity in a direction and number corresponding to the trace replay execution control request (e.g., taking a step forward, or repeating the entire routine by stepping over it), or by setting breakpoints at the trace locations, or by performing both of the above.

给出的示例仅仅是示出性的。本“发明内容”既不旨在标识所要求保护的主题的关键特征或必要特征,也不旨在用于限制所要求保护的主题的范围。相反,提供本“发明内容”是为了以简化的形式介绍一些技术概念,这些技术概念将在下面的“具体实施方式”中进一步描述。本发明以权利要求书来定义,并且在本发明内容与权利要求相抵触的情况下,以权利要求书为准。The examples given are merely illustrative. This "Summary" is not intended to identify key or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. Rather, this "Summary" is provided to introduce some technical concepts in a simplified form, which will be further described in the "Detailed Description" below. The invention is defined by the claims, and in the event of any conflict between the Summary and the claims, the claims shall prevail.

附图说明Attached Figure Description

将参考附图给出更具体的描述。这些附图仅说明所选择的方面,因此不能完全确定涵盖或范围。尽管虚线表示一些项是可选的,但在权利要求中记载的任何项或被本领域技术人员认为对于体现权利要求是非可选的任何项应当理解为以某种形式存在于权利要求的一个实施例中。A more specific description will be given with reference to the accompanying drawings. These drawings are only illustrative of selected aspects and therefore cannot fully define the coverage or scope. Although dashed lines indicate that some items are optional, any item recited in the claims or any item that a person skilled in the art would consider non-optional for embodying the claims should be understood to be present in some form in an embodiment of the claims.

图1是示出计算机系统并且还示出所配置的存储介质的框图;Figure 1 is a block diagram showing a computer system and also showing the configured storage media;

图2是示出实时过程调试的方面的框图;Figure 2 is a block diagram illustrating aspects of real-time process debugging;

图3是示出基于在单个特定时间点制作的存储器的副本来进行调试的方面的框图;Figure 3 is a block diagram illustrating aspects of debugging based on a copy of the memory made at a single point in time;

图4是示出用于基于跟踪的调试的示例架构的方面的框图,包括调试器与重放适配器之间的主请求和响应;Figure 4 is a block diagram illustrating aspects of an example architecture for trace-based debugging, including the main request and response between the debugger and the replay adapter;

图5是示出可以在调试期间引用或在跟踪中引用的各种存储器单元的框图;Figure 5 is a block diagram showing various memory cells that can be referenced during debugging or in tracing;

图6是示出机器级别请求的框图,该机器级别请求可以在执行跟踪的重放期间从执行跟踪寻找信息或施加执行控制;Figure 6 is a block diagram illustrating a machine-level request that can seek information from the execution trace or impose execution control during the replay of the execution trace.

图7是示出对机器级别请求的响应的框图;Figure 7 is a block diagram illustrating the response to a machine-level request;

图8是示出示例跟踪重放执行控制系统的框图;Figure 8 is a block diagram illustrating an example tracking replay execution control system;

图9是示出一些跟踪重放执行控制操作的框图;Figure 9 is a block diagram illustrating some of the control operations performed during the tracking and replay process;

图10是示出线程跟踪数据的一些方面的框图;Figure 10 is a block diagram illustrating some aspects of thread tracing data;

图11是示出一个或多个中间表示的一些方面的框图;Figure 11 is a block diagram illustrating some aspects of one or more intermediate representations;

图12是示出被适配于使用支持反向执行调试的跟踪的实时过程调试环境的一些方面的框图;Figure 12 is a block diagram illustrating some aspects of a real-time process debugging environment adapted to use traces that support reverse execution debugging;

图13是示出示例跟踪重放执行控制方法的流程图;以及Figure 13 is a flowchart illustrating an example trace replay execution control method; and

图14是进一步示出一些跟踪重放执行控制方法的流程图。Figure 14 is a flowchart further illustrating some of the tracking replay execution control methods.

具体实施方式Detailed Implementation

概述Overview

在生产云环境中的调试提出了严重的技术挑战。例如,假定对在线购物车的特定请求R不起作用。开发者如何在不减慢所有其他请求的处理速度并且使请求R的处理减速最小化的情况下调试请求R的处理?为了找到缺陷,开发者使用关于代码内部正在发生什么的信息,例如一种在请求R的处理期间查看一个或多个兴趣点处的变量的值的方式。Debugging in a production cloud environment presents significant technical challenges. For example, suppose a specific request R for an online shopping cart is not working. How can developers debug the processing of request R without slowing down the processing of all other requests and minimizing the slowdown in the processing of request R? To find the defect, developers use information about what is happening internally in the code, such as a way to look at the values of variables at one or more points of interest during the processing of request R.

这里讨论的基于跟踪的调试创新有助于克服传统方法不能够解决的技术难题。例如,很多传统的调试器和调试方法允许开发者设置暂停断点(halt breakpoint)以得到关于变量值的信息。暂停断点是暂停执行的指令,从而开发者有时间在处理中的给定点处检查存储器内容并且考虑观察到的可能解释。但是在生产环境中,暂停断点可能会暂停大量请求的处理,或者使请求彻底失败(例如,超时),或者使执行采取不同的执行路径,无论哪一个都是不希望的。即使仅暂停单个线程,也可能导致不希望的放弃请求,并且产生不能够预料的副作用,其阻碍调试、或降低性能、或两者。The trace-based debugging innovations discussed here help overcome technical challenges that traditional methods cannot solve. For example, many traditional debuggers and debugging methods allow developers to set halt breakpoints to obtain information about variable values. A halt breakpoint is an instruction to pause execution, giving developers time to examine memory contents at a given point in processing and consider possible interpretations of what is observed. However, in a production environment, halt breakpoints may pause the processing of a large number of requests, cause requests to fail completely (e.g., timeout), or cause execution to take a different path—none of which are desirable. Even pausing only a single thread can lead to unwanted aborted requests and produce unpredictable side effects that hinder debugging, degrade performance, or both.

一些熟悉的调试方法涉及在代码中的特定点处添加打印语句,以打印特定变量的值,或者添加其他代码,例如,以测试变量的值以查看其是否是开发者在代码中的这一点处期望的值。但是这些方法可能需要重新编译和重新部署代码,这在生产环境中不受欢迎,尤其是如果重新编译和重新部署要被多次完成作为迭代调试过程的一部分以查找和修复单个缺陷。Some familiar debugging methods involve adding print statements at specific points in the code to print the value of a particular variable, or adding other code, for example, to test the value of a variable to see if it is the value the developer expected at that point in the code. However, these methods may require recompiling and redeploying the code, which is undesirable in production environments, especially if recompiling and redeploying are to be done multiple times as part of an iterative debugging process to find and fix individual defects.

开发者可以在执行时间处将操作注入请求处理代码中,以制作与请求有关的部分或全部存储器的副本。副本可以包括“快照”304(经由写时复制与原始过程共享存储器分配页的过程的存储器中(in-memory)副本)或“转储”文件302(过程的序列化副本)或两者。一些传统的调试器可以读取转储文件或快照,并且在给定适当元数据的情况下,以特定格式呈现存储器内容,该特定格式示出从二进制被转换为包括变量名称的信息性结构的变量值并且基于变量的相应数据类型来显示变量值。但是将存储器转储到文件需要花费大量时间,这不仅会减慢请求R,而且会减慢示例场景中所有请求的处理。尽管拍摄快照比创建转储文件要快得多,但这可能会需要开发者的很多尝试来在处理中找到有用的点,以获取揭示缺陷的存储器快照,并且快照占用RAM中的空间。为了在转储文件或快照中捕获的除执行时间以外的时间中的另一点查看存储器,可以创建另一存储器副本。Developers can inject operations into request handling code at execution time to create a copy of some or all of the memory relevant to the request. This copy can include a "snapshot" 304 (an in-memory copy of a process that shares memory allocation pages with the original process via copy-on-write) or a "dump" file 302 (a serialized copy of the process), or both. Some traditional debuggers can read dump files or snapshots and, given appropriate metadata, present the memory contents in a specific format that shows variable values converted from binary to an informative structure including variable names and displayed based on the variable's corresponding data type. However, dumping memory to a file is time-consuming, slowing down not only request R but also the processing of all requests in the example scenario. While taking a snapshot is much faster than creating a dump file, it can require many attempts by the developer to find useful points in the processing to obtain a memory snapshot that reveals the defect, and snapshots consume space in RAM. To view memory at another point in time other than execution time, captured in a dump file or snapshot, another copy of the memory can be created.

为了在实时过程中的任何时间点查看存储器,实时过程被使用。在很多现代计算系统中,如图2中的示例所示,除了依赖于操作系统以外,实时调试对象202还包括运行时204。运行时204提供垃圾收集或动态代码编译(即,JIT编译或中间语言代码的编译)或两者。垃圾收集可以利用对象可达性分析、对象引用计数或其他策略。一些配置包括所解释的运行时204,并且本领域技术人员将认识到,通过将解释器的视图叠加到本机跟踪上并且使用解释器自身内的断点,本文中的教导可以被应用以对所解释的运行时进行执行控制。附加地,一些运行时(例如,运行时)并不总是JIT编译其IL表示(Java术语将其称为“字节码”)。而是,运行时可以选择为不常用的功能解释字节码。在这种情况下,执行控制可以进行运行时代码自身的执行控制,并且可以映射本机代码到内部运行时数据结构到IL到源代码。本机代码到内部运行时数据结构到IL的映射可以被视为中间本机映射812的示例,并且IL到源代码的映射可以被视为源中间映射810的示例。Real-time processes are used to view memory at any point in time during the real-time process. In many modern computing systems, as illustrated in the example in Figure 2, the real-time debug object 202, in addition to depending on the operating system, also includes a runtime 204. The runtime 204 provides garbage collection or dynamic code compilation (i.e., JIT compilation or compilation of intermediate language code) or both. Garbage collection may utilize object reachability analysis, object reference counting, or other strategies. Some configurations include an interpreted runtime 204, and those skilled in the art will recognize that the teachings herein can be applied to exercise execution control over the interpreted runtime by overlaying the interpreter's view onto the native trace and using breakpoints within the interpreter itself. Additionally, some runtimes (e.g., runtimes) do not always JIT compile their IL representation (what Java terminology calls "bytecode"). Instead, the runtime may choose to interpret bytecode for less frequently used functions. In this case, execution control may be exercised over the runtime code itself, and a mapping may be made from native code to internal runtime data structures to IL to source code. The mapping from native code to internal runtime data structures to IL can be considered an example of an intermediate native mapping 812, and the mapping from IL to source code can be considered an example of a source intermediate mapping 810.

与缺少运行时的过程可以通过插入暂停断点由调试器来直接控制不同。依赖于运行时的过程不能够被调试器200直接控制,因为它们的运行时有效地从调试器存储器项206隐藏,诸如存储器位置、存储器内容和指令指针。为了向开发者展示调试期间存储器中有什么,调试器向运行时发送要求当前存储器值的主请求214,运行时在主响应216中将这些值发送给调试器,调试器在某个用户界面210中显示其在回复消息中接收到的值。Unlike processes lacking runtime capabilities, which can be directly controlled by the debugger through the insertion of pause breakpoints, runtime-dependent processes cannot be directly controlled by the debugger 200 because their runtime is effectively hidden from the debugger's memory entries 206, such as memory locations, memory contents, and instruction pointers. To show the developer what is in memory during debugging, the debugger sends a main request 214 to the runtime requesting the current memory values. The runtime sends these values back to the debugger in a main response 216, and the debugger displays the values it received in the response message in a user interface 210.

作为先前方法的缺点的特定示例,考虑被实现为执行中间语言(IL)的虚拟机的运行时204。使用传统的本机代码调试器不能够轻松调试IL代码,因为该调试器将用于调试虚拟机/运行时,而不是用于调试IL代码。As a specific example of the drawbacks of the previous approach, consider runtime 204, which is implemented as a virtual machine executing intermediate language (IL). IL code cannot be easily debugged using a traditional native code debugger because that debugger is intended for debugging the virtual machine/runtime, not the IL code.

运行时还控制实时调试对象的执行。用于IL或进行向IL编译的语言的传统调试器通过在调试器与调试对象内部的运行时之间建立通信通道来工作。调试对象中的运行时进行提供调试体验所需要的大部分工作。在一个示例中,为了在偏移28处在方法Foo中的中间语言(IL)指令处设置断点,消息被发送至运行时,要求它在Foo偏移28处设置断点。然后,运行时内的线程将接收该消息,将Foo IL偏移28转换为驻留于存储器地址0x4567123512395处的机器指令,并且然后在该位置写入断点指令。类似地,为了执行熟悉的执行控制操作,诸如步进、步进进入、步进退出和步进跳过,调试器向运行时发送请求该操作的主请求214,运行时204执行该操作并且在主响应216中将已更新状态发送给调试器,并且调试器在某个用户界面210中显示在答复消息中所指示的结果。The runtime also controls the execution of the real-time debug object. Traditional debuggers for IL or languages that compile to IL work by establishing a communication channel between the debugger and the runtime inside the debug object. The runtime within the debug object performs most of the work required to provide the debugging experience. In one example, to set a breakpoint at offset 28 in the intermediate language (IL) instruction in method Foo, a message is sent to the runtime requesting it to set the breakpoint at offset 28 in Foo. The thread within the runtime then receives the message, translates Foo IL offset 28 into machine instructions residing at memory address 0x4567123512395, and then writes the breakpoint instruction at that location. Similarly, to perform familiar execution control operations, such as stepping, stepping in, stepping out, and stepping skipping, the debugger sends a main request 214 to the runtime requesting the operation. The runtime 204 performs the operation and sends an updated status to the debugger in a main response 216, and the debugger displays the result indicated in the response message in a user interface 210.

用户界面210以图形方式向用户显示调试器的调试对象程序状态的代表。程序状态的一些示例是线程的列表、要在每个线程上执行的下一行源代码、每个线程的调用栈、调用栈的每一帧中的一组变量、这些变量的值等。用户界面可以包括对例程的本地数据、所监视(watch)的变量及其值、源代码、表达式求值器、以及关于实时调试对象202的其他信息进行显示的窗口。User interface 210 graphically displays to the user a representation of the debugger's debug object program state. Examples of program states include a list of threads, the next line of source code to be executed on each thread, the call stack for each thread, a set of variables in each frame of the call stack, and the values of these variables. The user interface may include windows displaying local data of the routine, watched variables and their values, source code, expression evaluators, and other information about the live debug object 202.

在一些实现中,调试器200的运行时转换部分负责在低级别概念(诸如存储器单元和寄存器)与运行时抽象之间进行转换。运行时抽象的示例包括线程的列表、针对每个线程的一个或多个调用栈、以及接下来将要执行的IL指令。注意,抽象的运行时层的调用栈不一定与抽象的源代码级别处的调用栈相同,例如,虚拟机的调用栈与虚拟机中正在执行的IL代码的虚拟调用栈不一定匹配。In some implementations, the runtime translation section of debugger 200 is responsible for translating between low-level concepts (such as memory units and registers) and runtime abstractions. Examples of runtime abstractions include a list of threads, one or more call stacks for each thread, and the IL instructions to be executed next. Note that the call stack of the abstract runtime layer is not necessarily the same as the call stack at the abstract source code level; for example, the virtual machine's call stack may not match the virtual call stack of the IL code being executed within the virtual machine.

创建过程的执行跟踪418是可能的。然后可以使用计算机系统102的仿真来重放跟踪。有时,该跟踪过程是用源代码212编写的,高级别语言需要由运行时204执行实时调试对象202。跟踪本身可能很难调试,因为跟踪数据反映的是低级别处的视图(例如,运行时或即时编译的代码或两者),而不是编写程序的高级别语言。一些跟踪技术不提供用户104可能更喜欢的过程的高级别视图。大多数高级别运行时都要求运行时本身提供关于在其框架中运行的程序的信息。因此,常规调试可能要求过程在运行时内执行,而当调试基于跟踪而不是实时过程时,这不可选。Creating an execution trace 418 of the process is possible. The trace can then be replayed using a simulation of the computer system 102. Sometimes, the trace process is written in source code 212, a high-level language that needs to be executed by the runtime 204 in real-time debugging object 202. The trace itself can be difficult to debug because the trace data reflects a view at a low level (e.g., runtime or just-in-time compiled code or both), rather than the high-level language in which the program was written. Some tracing techniques do not provide a high-level view of the process that the user 104 might prefer. Most high-level runtimes require the runtime itself to provide information about the program running within its framework. Therefore, regular debugging may require the process to be executed within the runtime, which is not optional when debugging is based on a trace rather than a real-time process.

像任何其他过程一样,运行时可以被跟踪。然而,调试除运行时以外的软件比调试运行时更为常见。跟踪过程可以包括或排除跟踪其是运行时本身的一部分的一些或全部代码。Like any other process, runtime can be traced. However, debugging software other than runtime is more common than debugging runtime. The tracing process can include or exclude tracing some or all of the code that is part of the runtime itself.

该功能性不适用于没有当前执行运行时的跟踪文件。为了对正在执行依赖于运行时204的代码的实时过程的执行进行控制,调试器可以向运行时发送请求操作的消息,所请求的操作诸如“步进”(step)或者“运行”(run),然后运行时代表调试器执行该操作。This functionality does not apply to situations where there is no trace file currently running. To control the execution of a live process that is executing code that depends on a runtime 204 error, the debugger can send a message to the runtime requesting an action such as "step" or "run," which the runtime then performs on behalf of the debugger.

调试器向运行时发送消息以代表调试器执行操作的功能不适用于没有当前正在执行的运行时的跟踪文件。就运行时不可用而言,转储文件302和快照304与跟踪相似。运行时可以表示为转储或快照或跟踪,但它没有正在执行并且因此不能够以传统方法被调用。The ability for a debugger to send messages to the runtime to perform actions on behalf of the debugger does not apply to trace files for which there is no currently executing runtime. Dump files 302 and snapshots 304 are similar to traces in that the runtime is unavailable. A runtime can be represented as a dump, snapshot, or trace, but it is not currently executing and therefore cannot be invoked in the traditional way.

尽管如此,可以使跟踪文件420是调试环境的一部分。这里讨论的一些基于跟踪的调试实施例扩展了调试的权力(power),使得调试器可以从跟踪文件重放执行,从由开发者所选择的执行时间的一个或多个点开始,然后在跟踪执行中以由开发者所选择的增量向前或向后移动。一种方法是在跟踪与高级别语言调试器之间插入重放层。重放层理解运行时的执行控制消息,从而允许对所跟踪的过程进行高级别控制。Nevertheless, the trace file 420 can be made part of the debugging environment. Some trace-based debugging embodiments discussed here extend debugging power, allowing the debugger to replay execution from the trace file, starting from one or more points in execution time chosen by the developer, and then moving forward or backward in increments chosen by the developer within the trace execution. One approach is to insert a replay layer between the trace and a high-level language debugger. The replay layer understands runtime execution control messages, thereby allowing high-level control over the traced process.

在一些情况下,开发者可以使用“时间旅行”调试器来控制执行重放,以在重放记录的跟踪418时在执行时间中向前运行或在执行时间中向后运行,从而利用调试器的能力以有用的高级别(例如,被命名的和基于数据类型的)变量呈现形式来呈现诸如(多个)指令指针的程序状态信息和存储器,不仅像以前一样用于快照,现在还可以用于连续重放在代码执行期间所记录的执行时间的分段(segment)。通过将分组的跟踪数据与对应的源代码结构(诸如表达式和语句)对准,可以使调试更加有效。可以由开发者基于跟踪文件中所记录的低级别数据在高级别呈现中在多个点处检查在跟踪中所捕获的存储器值。In some cases, developers can use a "time travel" debugger to control execution replay, running forward or backward in execution time as the recorded trace 418 is replayed. This leverages the debugger's ability to present program state information and memory, such as instruction pointers (multiple), in useful high-level (e.g., named and data-data-based) variable representations, not only for snapshots as before but now for continuous replays of segments of execution time recorded during code execution. Debugging can be made more efficient by aligning grouped trace data with corresponding source code structures (such as expressions and statements). Developers can examine memory values captured in the trace at multiple points in a high-level representation based on the low-level data recorded in the trace file.

随着跟踪被重放,进行包括的重放层可以用于控制调试对象状态。如此适配,调试器200可以应用已经被记录为机器级别操作的过程跟踪的运行时(高级别)视图。仅出于本申请的目的,“机器级别”操作是在机器具体级别明细处所指明的操作。一般而言,“本机”和“机器级别”在本文中相对于指令或代码可互换使用。As the trace is replayed, the included replay layer can be used to control the state of the debug object. With this adaptation, debugger 200 can apply a runtime (high-level) view of the process trace that has been recorded as machine-level operations. For the purposes of this application only, "machine-level" operations are operations specified at the machine-specific level. Generally, "native" and "machine-level" are used interchangeably herein relative to instructions or code.

一些人可以在较广泛的上下文中查看本文中描述的一些实施例。例如,诸如控制执行、记录执行以及重放所记录的执行的概念可以被认为与特定实施例相关。然而,其并不遵从广泛上下文的可用性,在此寻求抽象概念的专有权;他们不是。而是,本公开关注于提供适当的特定实施例,这些实施例的技术效果完全或部分地解决特定技术问题,诸如如何将高级别控制请求与机器级别跟踪自动地相关联、以及本文中解决的其他问题。涉及控制执行、记录执行或重放所记录的执行的其他介质、系统和方法不在本发明范围之内。因此,在适当地理解本公开的情况下,也避免了模糊、仅仅抽象、缺乏技术特征以及伴随的证明问题。Some may view some of the embodiments described herein in a broader context. For example, concepts such as controlled execution, recorded execution, and replaying recorded execution may be considered relevant to specific embodiments. However, this does not accord with the availability of a broad context and seeks proprietary rights to abstract concepts; they are not. Rather, this disclosure focuses on providing suitable specific embodiments whose technical effects fully or partially solve specific technical problems, such as how to automatically associate high-level control requests with machine-level tracing, and other problems addressed herein. Other media, systems, and methods relating to controlled execution, recorded execution, or replaying recorded execution are not within the scope of this invention. Thus, ambiguity, mere abstraction, lack of technical features, and the associated problems of proof are also avoided upon proper understanding of this disclosure.

技术特征Technical features

本文中描述的实施例的技术特征对于本领域普通技术人员将是明显的,并且也将以多种方式对于各种专注读者而言是明显的。一些实施例解决植根于计算技术的技术活动并且通过帮助调试计算系统来改善这些系统的功能,从而相对于所产生的计算性结果来改善系统的正常运行时间、系统准确性和功率利用。例如,一些实施例提供系统可调试性功能性,其通过允许重放执行向后移动到期望点而不是从执行的起始重新开始并且向前移动到该点,来帮助减少由开发者在调试的同时对缺陷说明进行定位所花费的时间量。一些实施例通过将跟踪数据与对应的源代码语句准确地对准来改善系统的可调试性。一些实施例在系统中提供附加的调试功能性,诸如用于设置断点地址范围来取代一次在一个地址上设置断点的功能性。The technical features of the embodiments described herein will be apparent to those skilled in the art and will also be apparent to various interested readers in a variety of ways. Some embodiments address technical activities rooted in computing technology and improve the functionality of computing systems by aiding in debugging these systems, thereby improving system uptime, system accuracy, and power utilization relative to the computational results produced. For example, some embodiments provide system debuggability functionality that helps reduce the amount of time developers spend locating defects while debugging by allowing replay execution to move backward to the desired point rather than restarting from the beginning of execution and moving forward to that point. Some embodiments improve system debuggability by accurately aligning trace data with corresponding source code statements. Some embodiments provide additional debugging functionality in the system, such as the ability to set breakpoint address ranges instead of setting breakpoints at one address at a time.

一些实施例包括诸如计算硬件的技术性组件,该技术性组件以超出通用计算机内的典型交互的方式与软件交互。例如,除了一般交互(诸如一般的存储器分配、一般的存储器读取和写入、一般的指令执行、以及某种I/O)以外,本文中描述的一些实施例还实现了如本文中公开的向后步进退出重放操作。Some embodiments include technical components, such as computing hardware, that interact with the software in a manner that goes beyond typical interactions within a general-purpose computer. For example, in addition to general interactions (such as general memory allocation, general memory reads and writes, general instruction execution, and some form of I/O), some embodiments described herein also implement backward step-out replay operations as disclosed herein.

一些实施例提供的技术效果包括:更有效地使用调试时间、经减的重新跟踪以获取附加跟踪数据、以及经改进的调试器功能性用于缺陷因果关系的探索。Some of the technical effects provided by the embodiments include: more efficient use of debugging time, reduced re-tracing to obtain additional trace data, and improved debugger functionality for exploring defect causality.

一些实施例包括技术性适配。一些实施例包括重放层适配器,该重放层适配器接受针对运行时而被格式化的请求,即,以与熟悉的调试器运行时通信兼容的消息格式,并且以可以由运行时在实时调试期间使用的格式响应于这些请求。在一些实施例中,重放适配器提供隐藏实时过程调试、基于转储的调试以及基于时间旅行跟踪的调试之间的差异的接口。一些实施例包括源代码、(多个)中间表示以及跟踪数据之间的映射。Some embodiments include technical adaptations. Some embodiments include a replay layer adapter that accepts requests formatted for runtime, i.e., in a message format compatible with familiar debugger runtime communication, and responds to these requests in a format that can be used by the runtime during real-time debugging. In some embodiments, the replay adapter provides an interface that hides the differences between real-time process debugging, dump-based debugging, and time-travel tracing-based debugging. Some embodiments include a mapping between source code, intermediate representations(s), and trace data.

从所提供的描述,基于教导的技术特征的其他优点对于本领域技术人员也是明显的。From the provided description, other advantages of the technical features based on the teachings will also be apparent to those skilled in the art.

首字母缩写词和缩写Acronyms and Abbreviations

下面定义一些首字母缩写词和缩写。其他缩写可以在本文中的其他地方定义,或者不需要任何定义就能被本领域技术人员理解。The following defines some acronyms and abbreviations. Other abbreviations may be defined elsewhere in this document, or may not require any definition and will be understood by those skilled in the art.

ALU:算术和逻辑单元ALU: Arithmetic and Logic Unit

API:应用程序接口API: Application Programming Interface

BIOS:基本输入/输出系统BIOS: Basic Input/Output System

CD:压缩盘CD: Compressed disc

CPU:中央处理单元CPU: Central Processing Unit

DAC:数据访问组件DAC: Data Access Component

DVD:数字多功能盘或数字视频盘DVD: Digital Multifunction Disc or Digital Video Disc

FPGA:现场可编程门阵列FPGA: Field Programmable Gate Array

FPU:浮点处理单元FPU: Floating-point processing unit

GPU:图形处理单元GPU: Graphics Processing Unit

GUI:图形用户界面GUI: Graphical User Interface

IDE:集成开发环境,有时又称为“交互式开发环境”IDE: Integrated Development Environment, sometimes also called an "interactive development environment".

IL:中间语言IL: Intermediate Language

OS:操作系统OS: Operating System

RAM:随机存取存储器RAM: Random Access Memory

ROM:只读存储器ROM: Read-Only Memory

附加术语Additional terms

在本文中参考诸如附图中所示的示例性实施例,并且本文中使用特定语言来描述它们。然而,相关领域的技术人员可能想到的并且具有本公开的本文中示出的特征的改变和进一步修改以及本文中由特定实施例示出的抽象原理的附加技术应用应当被认为在权利要求的范围内。Reference is made herein to exemplary embodiments such as those shown in the accompanying drawings, and specific language is used to describe them. However, changes and further modifications to the features illustrated herein, as well as additional technical applications of the abstract principles illustrated by specific embodiments herein, that may occur to those skilled in the art, should be considered within the scope of the claims.

在本公开中声明了术语的含义,因此在阅读权利要求时应当仔细注意这些声明。给出了具体示例,但是相关领域的技术人员将理解,其他示例也可以落入所使用的术语的含义内,并且落入一个或多个权利要求的范围内。这里的术语不一定具有与它们在一般用途(尤其是在非技术用途中)、在特定行业的用途、在特定词典或词典中的用途相同的含义。附图标记可以与各种措词一起使用,以帮助示出术语的广度。从给定文本中省略附图标记并不一定表示该文本未讨论图的内容。发明人主张并且行使其对自己的词典编纂的权利。带引号的术语是显式地定义的,但也可以不使用引号而隐式定义术语。可以在“具体实施方式”中和/或在申请文件中的其他位置显式或隐式地定义术语。The meanings of the terms are stated in this disclosure, and these statements should be carefully considered when reading the claims. Specific examples are given, but those skilled in the art will understand that other examples may also fall within the meanings of the terms used and within the scope of one or more claims. The terms herein do not necessarily have the same meaning as they do in their general use (especially in non-technical use), in a particular industry, or in a particular dictionary or encyclopedia. Reference numerals may be used with a variety of wording to help indicate the breadth of the terminology. Omission of reference numerals from a given text does not necessarily mean that the text does not discuss the figures. The inventors claim and exercise their rights to their own lexicographical compilations. Terms in quotation marks are explicitly defined, but may also be implicitly defined without quotation marks. Terms may be defined explicitly or implicitly in the “Detailed Description” and/or elsewhere in the application.

如本文中使用的,“计算机系统”可以包括例如一个或多个服务器、主板、处理节点、膝上型计算机、平板电脑、个人计算机(便携式或非便携式)、个人数字助理、智能电话、智能手表、智能手环、蜂窝或移动电话、至少具有处理器和存储器的其他移动设备、视频游戏系统、增强现实系统、全息投影系统、电视、可穿戴计算系统、物联网节点、和/或提供至少部分由指令控制的一个或多个处理器的其他设备。指令可以采用固件或存储器和/或专用电路系统中的其他软件的形式。As used herein, "computer system" can include, for example, one or more servers, motherboards, processing nodes, laptop computers, tablets, personal computers (portable or non-portable), personal digital assistants, smartphones, smartwatches, smart bracelets, cellular or mobile phones, other mobile devices having at least a processor and memory, video game systems, augmented reality systems, holographic projection systems, televisions, wearable computing systems, Internet of Things nodes, and/or other devices that provide one or more processors that are at least partially controlled by instructions. Instructions may take the form of firmware or other software in memory and/or dedicated circuitry.

“多线程”计算机系统是支持多个执行线程的计算机系统。术语“线程”应当被理解为包括能够进行或被进行排程(并且可能进行同步)的指令的任何序列,并且例如还可以称为诸如“过程”或“协程”。线程可以并行地运行、顺序地运行、或以并行执行(例如,多处理)和顺序执行(例如,时间被切片地(time-sliced))的组合运行。A "multithreaded" computer system is a computer system that supports multiple threads of execution. The term "thread" should be understood to include any sequence of instructions that can be performed or scheduled (and possibly synchronized), and may also be referred to as, for example, as a "procedure" or "coroutine". Threads can run in parallel, sequentially, or in a combination of parallel execution (e.g., multiprocessing) and sequential execution (e.g., time-sliced).

“处理器”是线程处理单元,诸如同时多线程实现中的核心。处理器包括硬件。给定芯片可以容纳一个或多个处理器。处理器可以是通用的,也可以被定制用于特定用途,诸如矢量处理、图形处理、信号处理、浮点算术处理、加密、I/O处理等。A processor is a unit for processing threads, and is the core of implementations such as simultaneous multithreading. Processors comprise hardware. A given chip can contain one or more processors. Processors can be general-purpose or customized for specific purposes, such as vector processing, graphics processing, signal processing, floating-point arithmetic, encryption, I/O processing, etc.

“内核”包括操作系统、虚拟机监视器、虚拟机、BIOS代码和类似的硬件接口软件。The "kernel" includes the operating system, virtual machine monitor, virtual machine, BIOS code, and similar hardware interface software.

“代码”是指处理器指令、数据(包括常量、变量和数据结构)或指令和数据两者。“代码”和“软件”在本文中可互换使用。可执行代码、解释代码和固件是代码的一些示例。被解释或被编译以便执行的代码称为“源代码”。"Code" refers to processor instructions, data (including constants, variables, and data structures), or both. "Code" and "software" are used interchangeably in this document. Executable code, interpreted code, and firmware are some examples of code. Code that is interpreted or compiled for execution is called "source code."

“程序”在本文中被广泛地使用,以包括应用、内核、驱动、中断处理器、固件、状态机、库、以及由程序员(又称为开发者)编写和/或自动生成的其他代码。The term "program" is used extensively in this article to include applications, kernels, drivers, interrupt handlers, firmware, state machines, libraries, and other code written by programmers (also known as developers) and/or automatically generated.

“服务”是指在云计算环境或其他网络环境中进行提供的消耗性程序。"Service" refers to consumable programs provided in a cloud computing environment or other network environment.

“执行时间点”是指针对处理单元或线程的具体执行点,尤其是与跟踪执行有关的。本文中对“特定执行时间”或“执行时间t”等的引用是对执行时间点的引用。例如,可以将执行时间点实施为时间码变量或时间码值,或者实施为跟踪或执行活动的其他记录中的相对位置。执行时间点ta“早于”或“晚于”执行时间点tb表示两个执行时间点的相对顺序被确定。类似地,“较年轻”的执行时间点比“较老”的执行时间点晚的执行时间点。An "execution time point" refers to a specific point in time that is executed for a processing unit or thread, especially in relation to tracing execution. References to "specific execution time" or "execution time t" in this document refer to execution time points. For example, an execution time point can be implemented as a timecode variable or timecode value, or as a relative position in other records of tracing or execution activity. An execution time point ta "earlier than" or "later than" an execution time point tb indicates that the relative order of the two execution time points is determined. Similarly, a "younger" execution time point is a later execution time point than an "older" execution time point.

跟踪中有关跟踪事件的顺序的信息可能不完整。因此,跟踪可以具有足够的信息来确定事件A早于事件B,或确定事件D晚于事件C。但是就考虑跟踪来说,事件的相对顺序也可能是部分或完全不确定的。跟踪可以示出,事件E不在事件F之后,但这并不一定表示E在事件F之前;类似地,在没有跟踪还示出K在J之后的情况下,跟踪可以示出,事件K不在事件J之前。跟踪还可能缺少足够的信息来确立两个特定事件相对于彼此的任何顺序。Information regarding the order of events in a tracing may be incomplete. Therefore, a tracing may have enough information to determine that event A precedes event B, or that event D follows event C. However, the relative order of events may also be partially or completely uncertain, even when considering a tracing. A tracing may show that event E does not follow event F, but this does not necessarily mean that E precedes event F; similarly, without a tracing also showing that K follows J, a tracing may show that event K does not precede event J. A tracing may also lack sufficient information to establish any order of two specific events relative to each other.

“时间码”表示单调变化的值,该值可以用于对执行跟踪中的至少一些事件施加顺序。可以预期,时间码通常是单调递增的值,但是时间码也可以被实施为单调递减的值。时间码的一些示例包括指令计数器、时钟时间(又称时钟滴答)和完全人工的(不基于寄存器或指令的)单调值。依赖于跟踪,所有或一些或没有跟踪事件可以具有相应的相关联的时间码。当时间码存在时,它们可以是唯一的,或者由于一些时间码值重复,因此它们可能只是单调的。A "timecode" represents a monotonically changing value that can be used to impose order on at least some events in an execution tracing. It can be expected that timecodes are typically monotonically increasing values, but they can also be implemented as monotonically decreasing values. Some examples of timecodes include instruction counters, clock times (also known as clock ticks), and completely artificial (not register- or instruction-based) monotonic values. Depending on the tracing, all or some, or no, of the traced events may have corresponding associated timecodes. When timecodes exist, they can be unique, or they may simply be monotonic due to some timecode values being repeated.

“存储器单元”是指存储器的可寻址单元。一些示例包括RAM或ROM中的字节或字、处理器寄存器、高速缓存行、以及其他可寻址的存储器单元。A "memory cell" refers to an addressable unit of memory. Examples include bytes or words in RAM or ROM, processor registers, cache lines, and other addressable memory cells.

“仿真器”执行“仿真模拟”,该“仿真模拟”提供与原始硬件相同的功能,但是使用不同的实施或不同的硬件或两者。一个示例是CPU仿真器,其作用类似于CPU,并且可以像原始CPU硬件一样被用于执行代码,但是与原始CPU的实施不同,例如,仿真器可以在完全不同的物理硬件上运行。An emulator performs a simulation that provides the same functionality as the original hardware, but uses a different implementation or different hardware, or both. An example is a CPU emulator, which functions similarly to a CPU and can be used to execute code like the original CPU hardware, but with a different implementation; for example, the emulator can run on completely different physical hardware.

除非另有说明,否则如本文中使用的,“包括”允许附加的元素(即,包括是指包含)。Unless otherwise stated, as used herein, “include” allows for additional elements (i.e., include means contain).

“优化”是指改进,而不必须完美。例如,可以对已经优化的程序或算法进行进一步的改进。"Optimization" means improvement, not necessarily perfection. For example, an already optimized program or algorithm can be further improved.

例如,“过程”在本文中有时被用作计算科学领域的术语,并且在技术意义上涵盖计算性资源用户,即协程、线程、任务、中断处理器、应用过程、内核过程、过程(procedure)和对象方法。“过程”在本文中也用作专利法的术语,例如,在描述与系统权利要求或制品(所配置的存储介质)权利要求相对的过程权利要求时。类似地,“方法”在本文中有时被用作计算机科学领域的技术术语(一种“例程”),也被用作专利法领域的术语(“过程”)。本领域技术人员将理解在特定情况下意图使用的含义,还将理解(在专利法意义上的)给定的要求保护的过程或方法有时可以使用一个或多个过程或方法(在计算科学意义上)而被实现。For example, the term "process" is sometimes used herein as a term in the field of computer science and, in a technical sense, encompasses users of computational resources, namely coroutines, threads, tasks, interrupt handlers, application processes, kernel processes, procedures, and object methods. "Process" is also used herein as a term in patent law, for example, when describing process claims in contrast to system claims or claims of articles of manufacture (configured storage media). Similarly, the term "method" is sometimes used herein as a technical term in the field of computer science (a "routine") and also as a term in the field of patent law ("process"). Those skilled in the art will understand the meaning intended for use in particular contexts and will also understand that (in the sense of patent law) a given claimed process or method can sometimes be implemented using one or more processes or methods (in the sense of computer science).

与没有自动化相反,“自动地”是指利用自动化(例如,由软件配置的、用于本文中讨论的特定操作和技术效果的通用计算硬件)。尤其是,“自动地”执行的步骤虽然可以由人发起或由人以交互方式引导,但它们并不手动地在纸上或在人的脑海中执行。自动的步骤通过机器被执行,为了获取不利用如此提供的技术交互就不能够实现的一种或多种技术效果。Contrary to the absence of automation, "automatically" refers to the use of automation (e.g., general-purpose computing hardware configured by software for the specific operations and technical effects discussed herein). In particular, steps performed "automatically," while potentially initiated or interactively guided by a human, are not manually executed on paper or in the human mind. Automated steps are performed by machines to achieve one or more technical effects that would be impossible without such technological interaction.

技术人员理解,技术效果是技术实施例的推定目的。例如,在一个实施例中涉及计算,并且一些计算也可以在没有技术组件(例如,通过纸和铅笔,或者甚至作为精神步骤)的情况下执行,这一事实并不消除技术效果的存在或改变实施例的具体和技术性质。诸如以足够快的速度搜索跟踪数据以准许在原始执行速度的一个或两个数量级内进行重放的操作、以及用于对跟踪的本机指令分组并且将指令组与相应源代码项对准的计算在本文中应当理解为:除了其固有的数字本质以外,还需要以及提供人类思维步骤不能够获取的速度和准确性(人类的思维不能够直接与跟踪文件或其他数字存储对接以检索必要的跟踪数据)。本领域技术人员已经很好地理解了这一点,但是其他人有时可能会从事实的告知或提醒中受益。除非另有说明,否则与单纯的思想实验相反,实施例被假定能够在生产环境中或在生产环境的测试实验室中大规模操作。Those skilled in the art will understand that technical effects are the presumptive purpose of technical embodiments. For example, the fact that an embodiment involves computation, and that some computations can also be performed without technical components (e.g., by paper and pencil, or even as mental steps), does not eliminate the presence of technical effects or alter the specificity and technical nature of the embodiment. Operations such as searching trace data at a sufficiently fast speed to allow replay within one or two orders of magnitude of the original execution speed, and computations for grouping native instructions for the trace and aligning instruction groups with corresponding source code items, should be understood herein to require, in addition to their inherent digital nature, a speed and accuracy unattainable by human thought processes (human thought cannot directly interface with trace files or other digital storage to retrieve necessary trace data). This is well understood by those skilled in the art, but others may sometimes benefit from being informed or reminded of the facts. Unless otherwise stated, contrary to mere thought experiments, embodiments are assumed to be capable of large-scale operation in a production environment or a test laboratory within a production environment.

“计算性地”同样表示正在使用计算设备(至少是处理器加存储器),并且排除了仅凭人类思想或仅凭人类行动获取的结果。例如,如本文中理解的,用纸和铅笔进行算术不是计算性地进行算术。计算性结果更快,更广泛,更深入,更准确,更一致,更全面,和/或提供的技术效果超出了人类绩效范围。“计算性步骤”是计算性地执行的步骤。“自动地”或“计算性地”都不一定表示“立即”。“计算性地”和“自动地”在本文中可互换使用。"Computationally" also implies the use of computing devices (at least a processor and memory) and excludes results obtained solely by human thought or action. For example, performing arithmetic with paper and pencil, as understood herein, is not computationally arithmetic. Computational results are faster, broader, deeper, more accurate, more consistent, more comprehensive, and/or provide technical effects beyond the reach of human performance. A "computational step" is a step performed computationally. Neither "automatically" nor "computationally" necessarily means "immediately." "Computationally" and "automatically" are used interchangeably in this document.

“主动地”是指没有来自用户的直接请求。实际上,在直到步骤的结果已经被呈现给用户为止,用户甚至可能没有意识到一个实施例的主动步骤是可能的。除非另有说明,否则本文中描述的任何计算性和/或自动的步骤也可以主动地进行。"Actively" means without a direct request from the user. In fact, the user may not even be aware that an active step in an embodiment is possible until the result of the step has been presented to the user. Unless otherwise stated, any computational and/or automatic steps described herein may also be performed actively.

在整个文档中,使用可选的“(多个)”表示存在一个或多个所指示的特征。例如,“(多个)处理器”是指“一个或多个处理器”或等效地“至少一个处理器”。Throughout the document, the optional phrase "(multiple)" is used to indicate the presence of one or more of the indicated features. For example, "(multiple) processors" means "one or more processors" or equivalently "at least one processor".

出于美国法律和实践的目的,在权利要求书或其他地方使用本文中的“步骤”一词并非旨在调用手段加功能、步骤加功能或35美国法典第112条第六款/第112(f)条要求解释。特此明确驳斥对此种效果的任何推定。For purposes of U.S. law and practice, the use of the term “step” in the claims or elsewhere herein is not intended to invoke means plus function, steps plus function, or to require interpretation under 35 U.S.C. 112(6)/112(f). Any presumption of such effect is hereby expressly rejected.

出于美国法律和实践的目的,除非权利要求使用短语“用于……的手段”,否则它们并不意图援引手段加功能的解释。意图被解释为手段加功能语言的权利要求语言(如果有的话)将通过使用短语“用于……的手段”来明确叙述该意图。当采用手段加功能的解释时,无论是通过使用“用于……的手段”和/或通过法院对权利要求语言的法律解释,应当将说明书中针对给定名词或给定动词列举的手段理解为与权利要求语言链接在一起并且在此通过以下任何方式链接在一起:出现在附图框图中相同框内,用相同或相似名称表示,用相同附图标记表示。例如,如果权利要求限制中记载了“zac小部件”,并且该权利要求限制受制于手段加功能的解释,则至少在说明书中任何图块、段落或示例中提到“zac小部件”的任何地方标识的或由分配给zac小部件的任何附图标记绑在一起的所有结构应当视为zac小部件应用中标识的结构的一部分,并且有助于定义zac小部件结构的等效项集。For the purposes of U.S. law and practice, claims are not intended to invoke a means-plus-function interpretation unless the phrase “means for…” is used. Claim language intended to be interpreted as means-plus-function language (if any) will explicitly state this intention by using the phrase “means for…”. When a means-plus-function interpretation is adopted, whether by using “means for…” and/or by the court’s legal interpretation of the claim language, the means listed in the specification for a given noun or given verb shall be understood to be linked to the claim language and hereby linked in any way that: appears in the same box in the drawing block diagram, is denoted by the same or similar name, or is denoted by the same reference numerals. For example, if a claim limitation refers to “zac widget” and that claim limitation is subject to a means-plus-function interpretation, then all structures identified anywhere “zac widget” is mentioned in any block, paragraph, or example in the specification, or bound together by any reference numerals assigned to the zac widget, shall be considered part of the structures identified in the zac widget application and contribute to defining the equivalent itemset of the zac widget structure.

在整个文档中,除非另有明确说明,否则对过程中的步骤的任何引用均假定该步骤可以由感兴趣的一方直接执行,和/或由一方通过干预机制和/或干预实体间接执行,并且仍然在该步骤的范围内。也就是说,除非明确说明直接执行,否则该步骤不需要由相关方直接执行。例如,诸如对准、清除、编译、继续、控制、调试、仿真模拟、遇到、超过、执行、获取、分组、标识、映射、执行、接收、记录、重放、请求、响应、发送、设置、指定、步进(以及诸如步进进入、步进退出、步进跳过的变型)、终止、跟踪(以及对准、经对准的、清除、经清除的等)等涉及由感兴趣的一方所进行的、关于目的地或其他主题的动作的步骤可以涉及由某个其他方进行的干预动作,诸如转发、复制、上传、下载、编码、译码、压缩、解压缩、加密、解密、认证、调用等,但仍应当理解为直接由感兴趣一方执行。Throughout this document, unless otherwise expressly stated, any reference to a step in the process is assumed to be that the step can be performed directly by the interested party, and/or indirectly by a party through an intervention mechanism and/or intervention entity, and still within the scope of that step. That is, unless explicitly stated as directly performed, the step does not need to be performed directly by the interested party. For example, steps involving actions performed by the interested party concerning a destination or other subject, such as alignment, clearing, compiling, continuing, controlling, debugging, simulating, encountering, exceeding, executing, acquiring, grouping, identifying, mapping, receiving, recording, replaying, requesting, responding, sending, setting, specifying, stepping (and variations such as stepping in, stepping out, stepping skipping), terminating, tracing (and alignment, aligned, clearing, cleared, etc.), may involve intervention actions performed by another party, such as forwarding, copying, uploading, downloading, encoding, decoding, compressing, decompressing, encrypting, decrypting, authenticating, invoking, etc., but should still be understood as being performed directly by the interested party.

每当引用数据或指令时,应当理解,例如,这些项配置计算机可读存储器和/或计算机可读存储介质,从而将其转换为特定物品,与简单地存在于纸上、在一个人的思想中、仅仅是能量、或者仅仅是信号在电线上传播相反。出于美国专利保护的目的,根据美国专利商标局(USPTO)在re Nuijten案中的解释,存储器或其他计算机可读存储介质不是在可专利主题范围之外的传播信号、载波或仅能量。在美国,没有任何一项权利要求能够涵盖信号本身,并且任何主张相反的权利要求解释都是不合理的。除非在美国以外地区授予的权利要求中另有明确说明,否则权利要求并不涵盖信号本身。Whenever data or instructions are referenced, it should be understood that, for example, these items configure computer-readable storage memory and/or computer-readable storage media to convert them into a particular article, as opposed to simply existing on paper, in a person's mind, merely energy, or merely a signal propagating on a wire. For the purposes of U.S. patent protection, according to the interpretation of the U.S. Patent and Trademark Office (USPTO) in the re Nuijten case, memory or other computer-readable storage media is not a propagation of a signal, carrier wave, or merely energy outside the scope of the patentable subject matter. In the United States, no claim covers the signal itself, and any claim interpretation that asserts the contrary is unreasonable. Unless expressly stated otherwise in a claim granted outside the United States, the claims do not cover the signal itself.

此外,尽管本文中其他地方有明显相反的规定,但是应当理解(a)计算机可读存储介质和计算机可读存储器与(b)传输介质(又称为信号介质或仅能量)之间的明显区别。传输介质是传播信号或载波计算机可读介质或仅能量。相反,计算机可读存储介质和计算机可读存储器不是传播信号或载波计算机可读介质。除非在权利要求中另有明确说明,否则“计算机可读介质”是指计算机可读存储介质,不是传播信号本身,也不是仅能量。Furthermore, although there are obvious contrary provisions elsewhere herein, it should be understood that there is a clear distinction between (a) computer-readable storage media and computer-readable repositories and (b) transmission media (also referred to as signal media or energy-only). A transmission medium is a computer-readable medium or energy-only that propagates a signal or carrier wave. Conversely, computer-readable storage media and computer-readable repositories are not computer-readable media that propagate a signal or carrier wave. Unless expressly stated otherwise in the claims, “computer-readable medium” means computer-readable storage media, not the propagation of a signal itself, nor energy-only.

本文中的“实施例”是示例。术语“实施例”不能与“本发明”互换。实施例可以自由地共享或借用各方面以创建一些其他实施例(只要结果是可操作的),即使本文中本身未明确描述各方面的结果性组合。对于本领域技术人员而言,不需要明确描述的每个许可组合都是必要的,这与承认专利说明书是为本领域技术人员编写的政策相反。关于即使由少量可组合特征引起的可能组合的数目的形式化组合计算和非正式的直觉也将表明,本文中描述的各方面存在大量的方面组合。因此,要求每种组合的明确叙述与要求简明的专利说明书并且要求读者在有关技术领域具有知识的政策背道而驰。The term "example" in this document is illustrative. The term "example" is not to be used interchangeably with "invention." Examples may be freely shared or borrowed to create other examples (provided the result is operable), even if the resulting combinations of aspects are not explicitly described herein. It is necessary for a person skilled in the art to perceive that every licensed combination is essential, contrary to the policy of acknowledging that patent specifications are written for those skilled in the art. Formal calculations of combinations and informal intuition regarding the number of possible combinations, even those arising from a small number of composable features, will indicate that there are numerous combinations of aspects described herein. Therefore, requiring an explicit description of each combination contradicts the policy of requiring a concise patent specification and demanding knowledge of the relevant technical field from the reader.

附图标记列表List of reference numerals

提供以下列表是为了方便和支持附图以及作为说明书文本的一部分,其通过引用多个项来描述创新。尽管如此,这里未列出的项仍可以是给定实施例的一部分。为了使文本更清晰易读,在文本中一些(而非全部)引用项附近引用了给定的附图标记。可以参考给定项的不同示例或不同实例使用相同的附图标记。附图标记的列表是:The following list is provided for convenience and support of the accompanying drawings and as part of the specification text, which describe innovations by referencing multiple items. However, items not listed herein may still be part of a given embodiment. For clarity and readability, the given reference numerals are cited near some (but not all) of the referenced items in the text. Different examples or instances of the given items may use the same reference numerals. The list of reference numerals is:

100:操作环境,又称为计算环境100: Operating environment, also known as computing environment

102:计算机系统,又称为计算性系统或计算系统102: Computer system, also known as computing system or computing architecture.

104:用户104: User

106:外围设备106: Peripheral equipment

108:一般是网络108: Generally refers to the internet.

110:处理器110: Processor

112:计算机可读存储介质,例如RAM、硬盘112: Computer-readable storage media, such as RAM, hard disk

114:可移动地配置的计算机可读存储介质114: Removably configurable computer-readable storage media

116:通过处理器可执行的指令;可以在可移动介质上,也可以在其他存储器(易失性或非易失性或两者)中116: Processor-executable instructions; may be on removable media or in other memory (volatile or non-volatile or both).

118:数据118: Data

120:(多个)内核,例如,(多个)操作系统、BIOS、设备驱动程序120: (Multiple) kernels, such as (multiple) operating systems, BIOS, device drivers.

122:工具,例如防病毒软件、分析器(profiler)、调试器、编辑器、编译器、解释器、安全渗透测试器、模糊器、自动化性能监测工具等;可以被适配于使用本文中教导的执行控制122: Tools, such as antivirus software, profilers, debuggers, editors, compilers, interpreters, security penetration testers, obfuscators, automated performance monitoring tools, etc., can be adapted to use the execution control taught in this article.

124:应用,例如文字处理器、网络浏览器、电子表格124: Applications, such as word processors, web browsers, spreadsheets

126:显示屏126: Display screen

128:计算硬件,不以其他方式与附图标记106、108、110、112、114相关联128: Computing hardware, not otherwise associated with reference numerals 106, 108, 110, 112, 114.

200:调试器,也指代调试的活动200: Debugger, also referring to debugging activities.

202:实时调试对象程序或过程202: Real-time debugging of object programs or procedures

204:运行时,例如,公共语言运行时、虚拟机、或动态地转换代码以供执行的其他虚拟机(甲骨文美国公司的商标)204: Runtime, such as the Common Language Runtime, a virtual machine, or other virtual machines that dynamically translate code for execution (trademark of Oracle U.S., Inc.)

206:存储器项,例如,应用或系统数据结构206: Memory items, such as application or system data structures.

208:调试器的数据访问组件208: Data Access Components for the Debugger

210:调试器的用户界面210: Debugger User Interface

212:源代码,相关信息,诸如元数据和符号表212: Source code, related information such as metadata and symbol tables.

214:来自调试器的对调试对象信息源的主请求,例如实时调试对象或转储文件读取器软件或快照读取器软件或跟踪文件读取器软件214: A master request from the debugger for information about a source of debug object, such as a live debug object, dump file reader software, snapshot reader software, or trace file reader software.

216:对主请求的响应,该主请求从调试对象信息源或状态改变寻求信息;也称为“主响应”,如在主请求的抽象级别处的响应中,而不是如在第一或初始或最重要的响应中216: A response to a master request that seeks information from a debug object's information source or state change; also known as a "master response," such as in a response at the abstraction level of the master request, rather than in a first, initial, or most important response.

218:源代码中的语句;例如可以由分号或括号、大括号或方括号明确地定界,也可以用空格或行尾符(end-of-line)隐式地定界218: Statements in source code; for example, they can be explicitly delimited by semicolons or parentheses, curly braces or square brackets, or implicitly delimited by spaces or end-of-line characters.

220:源代码中的表达式;由所使用的编程语言在语法上定义;可以是函数调用的分配、对象成员的分配、例程调用、或者产生结果值或副作用的常量、变量、运算符和例程的另一组合220: An expression in the source code; syntactically defined by the programming language used; it can be an assignment of function calls, object member assignments, routine calls, or another combination of constants, variables, operators, and routines that produce a result or side effect.

302:转储文件,也称为存储器转储;可以包括附加信息,诸如索引或元数据302: Dump file, also known as a storage dump; may include additional information such as indexes or metadata.

304:存储器快照;可以包括附加信息,诸如索引或元数据304: Storage snapshot; may include additional information such as indexes or metadata.

402:调试器中的调试对象执行控制代码,例如,用于请求或仿真模拟对调试对象的执行控制,诸如步进通过调试对象、设置断点、执行调试对象直到到达断点等402: Execution control code for a debug object in the debugger, such as requesting or simulating execution control over the debug object, including stepping through the debug object, setting breakpoints, or executing the debug object until a breakpoint is reached.

404:调试器或其他工具中的跨级别映射,例如,源代码与中间表示之间的映射或中间表示与跟踪数据之间的映射404: Cross-level mapping in debuggers or other tools, such as mapping between source code and intermediate representation or mapping between intermediate representation and trace data.

406:重放组件,其使用跟踪文件来仿真模拟调试对象执行;跟踪重放组件406单独地或与其他执行控制器402、408(依赖于实现)一起,使用跟踪来仿真模拟原始过程的执行,并且允许随时间查看CPU状态和存储器单元;在一些实施例中,该仿真模拟可以向前或向后进行406: A replay component that uses trace files to simulate the execution of a debug object; the trace replay component 406, alone or in conjunction with other execution controllers 402, 408 (implementation-dependent), uses traces to simulate the execution of the original process and allows viewing of CPU state and memory units over time; in some embodiments, this simulation can be performed forward or backward.

408:用于重放组件的重放适配器,其允许重放组件发送请求和接收响应,这些响应也在实时过程的调试期间被使用;在跟踪文件调试场景中,重放层(即,重放组件加重放适配器)接收和响应于来自调试器的主请求,这些主请求可以由实时过程调试场景中的运行时进行接收和响应,并且重放适配器还可以做出对跟踪文件的次请求408: A replay adapter for the replay component, which allows the replay component to send requests and receive responses that are also used during real-time debugging. In a trace file debugging scenario, the replay layer (i.e., the replay component plus the replay adapter) receives and responds to main requests from the debugger, which can be received and responded to by the runtime in the real-time debugging scenario, and the replay adapter can also make secondary requests to the trace file.

410:重放适配器接口;被配置用于与调试器通信410: Replay adapter interface; configured for communication with the debugger.

414:来自重放适配器的对跟踪的次请求,其中“次”指示比主请求214的抽象级别低的抽象级别;该次请求可以是机器级别的请求,其可以被实施为到跟踪文件读取器的通信,也可以以内部方式被实施在重放适配器内(例如,作为函数调用)414: A secondary request for the trace from the replay adapter, where “secondary” indicates a lower level of abstraction than the main request 214; the secondary request may be a machine-level request, which may be implemented as communication to the trace file reader, or it may be implemented internally within the replay adapter (e.g., as a function call).

416:对机器级别请求的响应,该机器级别请求从跟踪寻求信息;也称为“次响应”,如在次请求的抽象级别的响应中,而不是如在第二响应中;可以被实施为从跟踪文件读取器的通信,也可以以内部方式被实施在重放适配器内(例如,作为函数结果或数据结构更新)416: A response to a machine-level request that seeks information from the trace; also known as a "secondary response," as in the response at the abstract level of the secondary request, rather than as in the second response; it can be implemented as communication from a trace file reader or internally within a replay adapter (e.g., as a function result or data structure update).

418:执行跟踪;尽管图4中的虚线示出了给定跟踪中可以包括个体项或省略了个体项,但是本文中假定跟踪不是空的,并且因此针对一般地是跟踪数据454的框上以实线示出;418也可以指代创建跟踪的活动,其有时也称为“跟踪”或“记录”418: Performing a trace; Although the dashed lines in Figure 4 indicate that a given trace may include individual items or omit individual items, this document assumes that the trace is not empty, and therefore it is shown as a solid line over the box that generally tracks data 454; 418 can also refer to the activity of creating a trace, which is sometimes also called a “trace” or “record”.

420:包含执行跟踪数据的跟踪文件;可以包括机器级别的跟踪数据,即,记录本机代码级别的执行活动的数据420: A trace file containing execution trace data; this may include machine-level trace data, i.e., data that records execution activities at the native code level.

422:在跟踪中精确到位的跟踪数据422: Precise tracking data during tracking.

424:在所跟踪的代码的执行中标识特定执行时间点的跟踪中的时间码;可以被链接到或被嵌入到跟踪内的其他数据中,例如,在跟踪数据中,该跟踪数据明确陈述在涉及所陈述的数据值的所陈述的存储器地址处与所陈述的操作相关联的执行时间点;时间码可以被实施为例如时钟滴答或指令计数器;对于每个被记录的操作,一些跟踪可以包含唯一时间码,但是在一些跟踪数据中,时间码也可以被重复或被省略424: A timecode in a trace that identifies a specific point in time during the execution of the traced code; it may be linked to or embedded in other data within the trace, for example, trace data that explicitly states the point in time at which the stated operation is associated with the stated memory address relating to the stated data value; the timecode may be implemented as, for example, a clock tick or an instruction counter; for each recorded operation, some traces may contain a unique timecode, but in some trace data, the timecode may be repeated or omitted.

428:跟踪中的时间码中的间隙,用于明确或隐式地指示其中未执行跟踪的执行时间点(例如,当对线程或处理单元禁用跟踪时的范围)。这可以包括相邻时间码相差大于默认值或指定增量(通常为1)的任何间隙,例如,时间码序列2、3、4、300、301、302的间隙在4至300之间,时间码序列250、500、750、1000、2000、2250、2500的间隙在1000到2000之间。428: Gap in the timecodes of a trace, used to explicitly or implicitly indicate the execution time points in which tracing was not performed (e.g., a range when tracing is disabled for a thread or processing unit). This can include any gap where adjacent timecodes differ by a default value or a specified increment (typically 1), for example, the gap for timecode sequences 2, 3, 4, 300, 301, 302 is between 4 and 300, and the gap for timecode sequences 250, 500, 750, 1000, 2000, 2250, 2500 is between 1000 and 2000.

430:到跟踪文件中的数据中的索引,例如反向查找数据结构,用于快速标识跟踪属性、存储器寿命索引信息、以及跟踪数据中可能特别令人感兴趣的位置的其他可搜索列表430: Indexes to data in the trace file, such as reverse lookup data structures, used to quickly identify trace attributes, memory lifetime index information, and other searchable lists of locations in the trace data that may be of particular interest.

432:跟踪数据中的关键帧;例如,可以以固定间隔存在于跟踪数据中,以准许重放以更快地跳转到关键帧处(或附近)的跟踪重放432: Keyframes in tracking data; for example, they may exist at fixed intervals in the tracking data to allow for faster replay jumps to (or near) keyframes during tracking playback.

434:所执行的代码,例如在调试对象运行并且被跟踪时由处理器执行的调试对象的机器级别代码的操作码和参数434: The code executed, such as the opcodes and parameters of the debug object's machine-level code executed by the processor while the debug object is running and being traced.

436:在调试对象运行并且被跟踪时发生的堆栈活动,例如,堆栈增长、堆栈收缩、以及该活动发生的执行时间点436: Stack activity that occurs while the object being debugged is running and being traced, such as stack growth, stack shrinkage, and the execution time at which this activity occurs.

438:数据流;可以对应于单个线程或一组线程,可以对应于处理器单元(例如,处理器核心);可以对应于给定处理器插槽中的所有核心;可以注释有元数据,以帮助重放438: Data stream; can correspond to a single thread or a group of threads, can correspond to a processor unit (e.g., a processor core); can correspond to all cores in a given processor socket; can be annotated with metadata to aid in replay.

440:在调试对象运行并且被跟踪时发生的处理器核心活动,例如,由核心执行的指令的操作码和参数440: Processor core activities that occur while the debug object is running and being traced, such as the opcodes and parameters of instructions executed by the core.

442:在调试对象运行并且被跟踪时发生的处理器插槽活动,例如,由位于给定处理器插槽中的任何核心执行的指令的操作码和参数442: Processor socket activity that occurs while the debug object is running and being traced, such as the opcodes and parameters of instructions executed by any core located in a given processor socket.

444:在调试对象运行并且被跟踪时发生的线程活动,例如,在线程运行时执行的指令、在线程运行时进行的存储器单元访问、相关联的元数据,诸如线程ID和时间码444: Thread activity that occurs while the debug object is running and being traced, such as instructions executed during thread runtime, memory accesses performed during thread runtime, and associated metadata such as thread IDs and timestamps.

446:在调试对象运行并且被跟踪时发生的寄存器活动,例如,在什么时间码从哪个寄存器读取什么值、在什么时间码向哪个寄存器写入什么值446: Register activities that occur while the debug object is running and being traced, such as what value is read from which register at what timecode, and what value is written to which register at what timecode.

448:存储器地址448: Memory address

450:指令操作码450: Instruction opcode

452:数据值452: Data value

454:一般地是跟踪数据454: Generally refers to tracking data.

456:元组,即,在跟踪中相关联的跟踪数据的两个或更多项,代表在跟踪执行期间的相同操作;例如,存储器读取操作或存储器写入操作可以作为元组被记录在跟踪中的单个行上,该元组包含或以其他方式将操作码(例如,读取或写入)、地址(例如,RAM地址或寄存器ID)、以及已经读取或写入的数据值相关联在一起456: A tuple, i.e., two or more items of trace data associated in a trace, representing the same operation during trace execution; for example, a memory read operation or a memory write operation may be recorded as a tuple on a single line in the trace, which contains or otherwise associates the opcode (e.g., read or write), the address (e.g., RAM address or register ID), and the data value that has been read or written together.

458:跟踪条目458: Tracking entry

502:存储器单元,例如RAM或ROM中的字节或字、处理器寄存器、高速缓存线、或其他可寻址存储器单元502: Memory unit, such as a byte or word in RAM or ROM, processor register, cache line, or other addressable memory unit.

504:堆栈,例如,存储器的一部分,当例程被进入时状态信息被推入其中,并且然后随着控制从例程返回到调用例程的代码而被弹出;通常区别于堆存储器504: The stack, for example, is a portion of memory where state information is pushed when a routine is entered, and then popped as control returns from the routine to the code that called the routine; it is generally distinguished from heap memory.

506:堆栈基地址,其定义起始点,从该起始点开始在连续的存储器中分配堆栈;堆栈被假定利用系统中的堆栈存储器的分配在已知方向上增长,这在给定系统中可以是向上的方向(即,地址随着项被推入堆栈而增加),但在另一系统中,其也可以向下(即,地址随着项被推入堆栈而减小);术语“增长的”在此是指在所讨论的系统上在堆栈增长的方向上,而“收缩的”是指在相反方向上506: The stack base address defines the starting point from which the stack is allocated in contiguous memory; the stack is assumed to grow in a known direction using the allocation of stack memory in the system, which in a given system may be upward (i.e., the address increases as an item is pushed onto the stack), but in another system it may also be downward (i.e., the address decreases as an item is pushed onto the stack); the term "growing" here refers to the direction of stack growth in the system under discussion, while "shrinking" refers to the opposite direction.

508:堆栈框架,即分配记录,其当例程被调用时被分配在堆栈上;通常包含返回地址,该地址标识代码中的位置,该位置是例程返回时将恢复执行的位置;也可以包含当例程被调用时作为参数传递给例程的值、或这样的参数值的地址508: Stack frame, or allocation record, is allocated on the stack when a routine is called; it typically contains the return address, which identifies the location in the code where execution will resume when the routine returns; it may also contain the address of a value passed as an argument to the routine when it is called, or the address of such an argument value.

510:随着构造和释放对象而分配和释放的堆存储器;在一些情况下,堆可以进行自动垃圾收集,该堆标识并且标记为可用存储器,可用存储器保持过程的实时执行期间不再可达的对象;在其他情况下,从堆分配的存储器需要单独的显式调用以释放所分配的存储器。510: Heap memory allocated and released along with the construction and release of objects; in some cases, the heap can be automatically garbage collected, and the heap identifies and marks it as available memory, which holds objects that are no longer reachable during the live execution of the process; in other cases, memory allocated from the heap requires a separate explicit call to release the allocated memory.

512:对象512: Object

514:高速缓冲存储器;例如可以在RAM工作存储器中或在处理器芯片上514: Cache memory; for example, it can be in RAM working memory or on the processor chip.

516:处理器核中的寄存器516: Registers in the processor core

518:对象属性;被命名的值,它是对象的组成部分;可以是函数,在这种情况下,该属性通常称为方法;也是指实现对象属性的函数;函数是返回值的例程518: Object property; a named value that is part of an object; it can be a function, in which case the property is usually called a method; it also refers to a function that implements an object property; a function is a routine that returns a value.

520:ROM(只读存储器);通常是非易失性的520: ROM (Read-Only Memory); typically non-volatile.

522:除了板载ROM之外的非易失性存储器,诸如可移动闪存、磁盘或光盘存储、磁带存储等。522: Non-volatile memory other than onboard ROM, such as removable flash memory, disk or optical disk storage, magnetic tape storage, etc.

524:RAM(随机存取存储器);通常为易失性的524: RAM (Random Access Memory); typically volatile.

526:本地存储器,例如,对于所陈述的或隐式的上下文是本地的存储器,诸如在例程的执行期间相对于例程是本地的并且然后被释放,或者相对于线程是本地的526: Local memory, for example, memory that is local to the stated or implicit context, such as memory that is local to the routine during its execution and then freed, or memory that is local to the thread.

528:全局存储器,例如对于所陈述的或隐式的上下文是全局的存储器,诸如在它们中的任何一个的执行期间相对于一组多个例程是全局的,或者相对于一组线程是全局的528: Global memory, such as memory that is global for a stated or implicit context, such as memory that is global relative to a set of multiple routines or relative to a set of threads during the execution of any of them.

530:存储器的特性,其增加或减小线程外部的实体将改变存储在存储器单元中的值的可能性,例如,存储器单元是否相对于其他线程被写保护,是否在共享存储器(诸如相对多个线程是全局的存储器)中530: The characteristics of memory that the addition or reduction of an entity outside a thread may alter the value stored in the memory cell, such as whether the memory cell is write-protected relative to other threads, or whether it is in shared memory (such as memory that is global relative to multiple threads).

602:存储器单元规格,例如,ROM或RAM或高速缓存中的地址,或寄存器ID,或通过将存储器单元与其他存储器单元区分开以准许访问(读或写,或合理尝试读或写)该存储器单元来指明该存储器单元的另一项;也可以指明多个存储器单元,例如,作为地址的范围602: Memory cell specification, such as an address in ROM or RAM or cache, or a register ID, or another item that specifies the memory cell by distinguishing it from other memory cells to allow access (read or write, or a reasonable attempt to read or write) to the memory cell; multiple memory cells may also be specified, for example, as a range of addresses.

604:寄存器ID,例如,寄存器名称,或者到寄存器阵列的索引604: Register ID, for example, register name, or index to a register array.

606:地址范围,即,对对应的连续存储器单元的集合进行标识的相邻地址的集合;作为一个示例,可以将范围指明为一对地址(高地址和低地址);作为另一示例,可以将范围指明为基地址和基于基地址的连续单元的计数606: Address range, that is, a set of adjacent addresses that identify a set of corresponding contiguous memory units; as an example, a range can be specified as a pair of addresses (high address and low address); as another example, a range can be specified as a base address and a count of contiguous units based on the base address.

608:一个或多个执行时间点的规定,例如,作为特定时间码或者时间码的范围;可以将范围指明为一对时间码(开始时间码和结束时间码),也可以将范围指明为基时间码和时间码增量的计数,诸如时钟滴答的数目或指令的数目608: A specification of one or more execution time points, for example, as a specific time code or a range of time codes; the range can be specified as a pair of time codes (start time code and end time code), or it can be specified as a base time code and a count of time code increments, such as the number of clock ticks or the number of instructions.

610:指令计数,可用作时间码;可以是从过程开始执行时的绝对计数,也可以是诸如从线程恢复执行时的相对计数610: Instruction count, which can be used as a time code; it can be an absolute count from the start of execution of a procedure, or a relative count such as when execution resumes from a thread.

612:系统时钟值,例如,以毫秒或CPU周期数为单位612: System clock value, for example, in milliseconds or CPU cycles.

614:执行时间范围规定,即,指明执行时间点的范围的数据;例如,可以被实施为一对时间码(开始和结束)或被实施为基时间码和基于基时间码的时间码增量的计数614: Execution time range specification, that is, data that specifies the range of execution time points; for example, it can be implemented as a pair of time codes (start and end) or as a base time code and a count of time code increments based on the base time code.

616:执行时间点616: Execution Time Point

618:执行控制操作,例如,向前步进、反向步进跳过、去往所指明的位置、设置或清除断点等618: Perform control operations, such as stepping forward, stepping backward to skip, going to the specified location, setting or clearing breakpoints, etc.

620:执行控制操作的标识符;对于步进或继续操作,其引用或包括方向(即,向前或向后;“反向”和“向后”在本文中可互换使用),并且还引用或包括增量大小(例如,一步,步进跳过例程,或继续直到遇到断点)620: Identifier for performing a control operation; for step or continue operations, it refers to or includes the direction (i.e., forward or backward; "reverse" and "backward" are used interchangeably in this document), and also refers to or includes the increment size (e.g., one step, step skipping a routine, or continue until a breakpoint is encountered).

702:从跟踪数据导出的数据值702: Data values derived from tracking data

704:指令指针,其标识跟踪数据中的特定指令或执行时间点;这是重放执行向前或向后移动的引用位置;“向后”是指朝着执行时间点越来越年轻的方向,“向前”是指朝着执行时间点越来越老的方向704: Instruction Pointer, which identifies a specific instruction or execution point in the trace data; it is a reference position for replay execution to move forward or backward; "backward" means towards younger execution points, and "forward" means towards older execution points.

706:状态码,指示请求的结果,例如,执行控制操作成功、执行控制操作被发起(用于异步控制)、执行控制操作失败706: Status code indicating the result of a request, such as successful execution of control operation, control operation initiated (for asynchronous control), or control operation failed.

800:跟踪重放执行控制系统800: Tracking and Replay Execution Control System

802:所跟踪的程序的过程;可以包括一个或多个线程802: The process of the program being traced; it may include one or more threads.

804:线程804: Thread

806:来自用户对用于执行控制操作的工具的请求806: A user request for a tool used to perform control operations.

808:程序元数据或工具元数据,例如,没有另外具体编号但仍在此讨论的数据808: Program metadata or tool metadata, such as data that does not have a separate specific number but is still discussed here.

810:源中间映射,即,源代码或(多个)源代码项与源代码或(多个)源代码项的一个或多个中间表示之间的映射;映射810是跨级别映射404的示例810: Source intermediate mapping, i.e., a mapping between source code or source code item(s) and one or more intermediate representations of source code or source code item(s); mapping 810 is an example of cross-level mapping 404.

812:中间本机映射,即,一个或多个中间表示与本机指令或其他跟踪数据之间的映射;映射812是跨级别映射404的示例812: Intermediate native mapping, i.e., a mapping between one or more intermediate representations and native instructions or other trace data; mapping 812 is an example of cross-level mapping 404.

814:跟踪中的本机指令116的记录;可以包括例如精确到位的跟踪数据422、执行代码434、元组456或一般地是跟踪数据454814: Record of native instruction 116 in the trace; may include, for example, trace data 422 with precise location, executed code 434, tuple 456, or generally trace data 454.

816:JIT(即时)编译器816: JIT (Just-In-Time) Compiler

818:对例程的调用或其他调用,例如,将控制权传递到异常处理器或中断处理器818: Calls to routines or other calls, such as transferring control to an exception handler or interrupt handler.

820:返回地址,即,在调用818之后执行将在此继续的执行时间点或指令820: Return address, that is, the point in time or instruction where execution will continue after calling 818.

822:一组跟踪数据,诸如本机指令,其对应于特定源代码语句S或源代码表达式E;例如,这可以包括指令的执行的记录,这些指令全部是通过编译源代码语句S或源代码表达式E而产生的,而不是从与S或E相邻的源代码语句和源代码表达式的编译产生的822: A set of trace data, such as native instructions, that correspond to specific source code statements S or source code expressions E; for example, this could include a record of the execution of instructions that are generated entirely by compiling source code statements S or source code expressions E, rather than from the compilation of source code statements and expressions adjacent to S or E.

824:组822的边缘指令;每个组通常具有两个边缘——如果指令是有序的,则一个边缘是该组中最年轻的指令,另一边缘是该组中最老的指令;不管一组指令中的所有指令是否彼此相对排序,当指令X满足以下条件中的至少一个条件时,跟踪中的一组指令G的X在G的边缘上:X是在跟踪的向前执行期间遇到的G的第一指令(“第一向前边缘”),X是在跟踪的向前执行期间遇到的G的最后指令(“最后向前边缘”),X是在跟踪的向后执行期间遇到的G的第一指令(“第一向后边缘”),或者X是在跟踪的向后执行期间遇到的G的最后指令(“最后向后边缘”)824: Edge instructions of group 822; each group typically has two edges—if the instructions are ordered, one edge is the youngest instruction in the group, and the other edge is the oldest instruction in the group; regardless of whether all instructions in a group are ordered relative to each other, an instruction X in a group of instructions G in the tracing is on an edge of G when X satisfies at least one of the following conditions: X is the first instruction of G encountered during forward execution of the tracing (“first forward edge”), X is the last instruction of G encountered during forward execution of the tracing (“last forward edge”), X is the first instruction of G encountered during backward execution of the tracing (“first backward edge”), or X is the last instruction of G encountered during backward execution of the tracing (“last backward edge”).

826:中间表示,例如,低级别代码,诸如中间语言代码、或抽象语法树、或符号表826: Intermediate representation, such as low-level code, like intermediate language code, or abstract syntax tree, or symbol table.

828:断点828: Breakpoint

830:断点范围830: Breakpoint Range

902:向前步进操作,也称为“向前步进”或“步进”(当默认或仅方向是向前的时),是指向前步进跳过一个源代码语句902: Forward step operation, also known as "forward step" or "step" (when the default or only direction is forward), refers to stepping forward and skipping one source code statement.

904:向前步进进入操作,也称为“向前步进进入”或“步进进入”(默认或仅方向是向前的时),是指向前步进跳过进入例程,因此要执行的下一语句是例程的主体的第一语句904: Forward step-in operation, also known as "forward step-in" or "step-in" (default or only when the direction is forward), means that the entry into the routine is skipped forward, so the next statement to be executed is the first statement of the routine body.

906:向前步进跳过操作,也称为“向前步进跳过”或“步进跳过”(默认或仅方向是向前的时),是指向前步进跳过进入并且通过例程,因此要执行的下一语句是调用例程之后的第一语句906: Forward step skip operation, also known as "forward step skip" or "step skip" (default or only when the direction is forward), means stepping forward and skipping through the routine, so the next statement to be executed is the first statement after the routine call.

908:向前步进退出操作,也称为“向前步进退出”或“步进退出”(默认或仅方向是向前的时),是指向前步进跳过通过当前例程的剩余部分,因此要执行的下一语句是调用例程之后的第一语句908: Forward step-out operation, also known as "forward step-out" or "step-out" (default or only when the direction is forward), means that forward stepping skips the remainder of the current routine, so the next statement to be executed is the first statement after the routine call.

910:继续向前操作,当默认或仅方向是向前的时,也称为“继续”或“运行”,是指继续向前执行,直到遇到断点或过程终止910: Continue forward operation. When the default or only the direction is forward, also known as "continue" or "run," it means continuing execution forward until a breakpoint is encountered or the process terminates.

912:向后步进操作,也称为“向后步进”,是指向后步进跳过一个源代码语句912: The backward step operation, also known as "stepping backward," refers to skipping one source code statement by stepping backward.

914:向后步进进入操作,也称为“向后步进进入”,是指向后步进跳过进入例程,因此要反向执行的下一语句是例程的主体的最后语句914: Step-back entry, also known as "step-forward entry," means stepping backward into the routine. Therefore, the next statement to be executed in reverse is the last statement of the routine body.

916:向后步进跳过操作,也称为“向后步进跳过”,是指向后步进跳过进入并且通过例程,因此要反向执行的下一语句是调用例程之前的第一语句916: The backward step skip operation, also known as "backward step skip," refers to stepping backward into and through a routine, so the next statement to be executed in reverse is the first statement before the routine call.

918:向后步进退出操作,也称为“向后步进退出”,是指向后步进跳过通过当前例程的剩余部分,因此要反向执行的下一语句是调用例程之前的第一语句918: Step backward, also known as "step back out," means stepping backward to skip the remainder of the current routine. Therefore, the next statement to be executed in reverse is the first statement before the routine call.

920:继续向后操作,也称为“向后继续”或“向后运行”或“反向运行”,是指继续向后执行,直到遇到断点或到达过程开始920: Continue backwards, also known as "continue backwards," "run backwards," or "run in reverse," means continuing execution backwards until a breakpoint is encountered or the process begins.

一些实现可以例如通过执行更多或更少的指令或通过使用不同的名称来对操作902-920使用不同的定义。Some implementations may use different definitions for operations 902-920, for example, by executing more or fewer instructions or by using different names.

922:设置断点范围,即指明:在遇到多个地址或执行时间点的所指明的范围内的任何地址或执行时间点时,执行应当断点暂停922: Set a breakpoint range, which specifies that execution should pause at any address or execution time point within the specified range of multiple addresses or execution time points.

924:设置断点924: Setting Breakpoints

1004:线程ID1004: Thread ID

1006:线程状态,例如,被创建的、可运行、正在运行、挂起、阻塞、终止1006: Thread state, such as created, runnable, running, suspended, blocked, terminated.

1008:线程代码,即,当线程运行时所执行的或可以执行的代码1008: Thread code, that is, the code that is executed or can be executed when a thread runs.

1010:线程存储器,例如,其对于线程是本地的的存储器、或者其对于线程是全局的并且随线程执行而被线程访问的存储器1010: Thread memory, for example, memory that is local to a thread, or memory that is global to a thread and is accessed by the thread as it executes.

1102:符号表1102: Symbol Table

1104:在源代码中使用的标识符1104: Identifiers used in the source code

1106:数据类型1106: Data Type

1108:抽象数据树1108: Abstract Data Tree

1110:中间语言,例如,微软通用中间语言、字节码(甲骨文公司的商标)、寄存器传输语言、Parrot中间表示、标准便携式中间表示、IR中间语言(LLVM基金会公司的商标)等1110: Intermediate languages, such as Microsoft General Intermediate Language, bytecode (Oracle Corporation trademark), Register Transfer Language, Parrot Intermediate Representation, Standard Portable Intermediate Representation, IR Intermediate Language (LLVM Foundation trademark), etc.

1112:中间语言代码1112: Intermediate Language Code

1300:示例跟踪重放执行控制方法、和示出上述方法的流程图1300: Example of a trace replay execution control method, and a flowchart illustrating the above method.

1302:标识程序1302: Identification Procedure

1304:接收执行控制请求1304: Received execution control request

1306:使用源代码与中间表示之间的映射1306: Using a mapping between source code and intermediate representation

1308:使用中间表示与跟踪之间的映射1308: Using the mapping between intermediate representation and tracking

1310:例如通过向前或向后执行或者在这样的执行上设置参数(方向、增量)来控制答复1310: For example, controlling the response by executing forward or backward, or by setting parameters (direction, increment) on such execution.

1312:在重放期间执行所跟踪的指令,例如,通过仿真模拟或通过将跟踪中所指明的操作转换为对本机指令(不一定全部在跟踪中)的重放的控制1312: Execute the traced instructions during replay, for example, by emulation or by controlling the replay of operations specified in the trace as native instructions (not necessarily all of which are in the trace).

1314:设置断点或断点范围;包括922或924或两者1314: Set a breakpoint or breakpoint range; including 922, 924, or both.

1316:发送对执行控制请求的响应1316: Send a response to the execution control request.

1318:例如通过在断点暂停之前执行直到该组的边缘,将一组所跟踪的指令与源代码语句或表达式对准1318: For example, by executing up to the edge of the group before pausing at a breakpoint, align a set of traced instructions with source code statements or expressions.

1400:流程图1400: Flowchart

1402:这样标识向后步进退出请求1402: This indicates a backward stepping exit request.

1404:在所指明的位置之前紧接的执行位置处设置断点;当A在跟踪的向前执行期间在B之前被遇到并且A与B之间存在最多五个跟踪本机代码指令时,位置A在跟踪中在位置B“之前紧接”1404: Sets a breakpoint at the execution location immediately preceding the specified location; when A is encountered before B during forward execution of the trace and there are at most five trace native code instructions between A and B, location A is "immediately preceding" location B in the trace.

1406:在与特定源代码语句或表达式相对应的一组指令的边缘处设置断点1406: Set a breakpoint at the edge of a set of instructions that corresponds to a specific source code statement or expression.

1408:设置断点范围,该断点范围涵盖(并且在一些实现中匹配)被指定为接收动态编译(“即时的”(jitted))代码的地址的范围1408: Sets a breakpoint range that covers (and in some implementations matches) the range specified as receiving dynamically compiled (“jitted”) code.

1410:设置断点,以步进跳过所指明的运行时例程1410: Set a breakpoint to step over the specified runtime routine.

1412:在原始执行或重放执行期间遇到指令1412: An instruction was encountered during the original execution or replay execution.

1414:超出对同时被监测的断点的最大数目的硬件约束1414: Exceeding the hardware constraint on the maximum number of breakpoints that can be monitored simultaneously.

1416:避免终止程序1416: Avoid terminating the procedure

1418:终止程序1418: Termination of Procedure

1420:例如通过指明关于要执行的源代码语句或表达式的执行来在高级别控制原始执行或重放执行1420: For example, by specifying the execution of source code statements or expressions to be executed, one can gain high-level control over the original execution or replay execution.

1422:执行(原始或重放)过程、线程或程序1422: Execute (original or replay) a process, thread, or program.

1424:获取用户对源代码语句或表达式的选择1424: Get the user's selection of source code statements or expressions

1426:用户对源代码语句或表达式的选择1426: User selection of source code statements or expressions

1428:调试过程、线程或程序1428: Debugging process, thread, or program

1430:向前执行过程、线程或程序1430: Forward execution process, thread, or program

1432:向后执行过程、线程或程序1432: Backward execution of a process, thread, or program

1434:设置大断点范围;当涵盖跟踪中的至少一千个连续地址或指令时,该断点范围为“大”1434: Set a large breakpoint range; this breakpoint range is "large" when it covers at least one thousand consecutive addresses or instructions in the trace.

1436:大断点范围1436: Large breakpoint range

1438:记录来自实时过程的跟踪数据1438: Recording tracking data from the real-time process.

1440:对所跟踪的指令分组,即,创建或指明组8221440: Group the traced instructions, i.e., create or specify group 822

1442:清除断点或断点范围1442: Clear breakpoints or breakpoint ranges

操作环境Operating environment

参考图1,用于一个实施例的操作环境100包括至少一个计算机系统102。计算机系统102可以是多处理器计算机系统,也可以不是。操作环境可以包括给定计算机系统中的一个或多个机器,这些机器可以在云中被群集、被进行客户端服务器联网和/或被进行对等联网。个体机器是计算机系统,一组协作机器也是计算机系统。给定计算机系统102可以被配置用于例如具有应用的最终用户、用于管理员、作为服务器、作为分布式处理节点、和/或是其他方式。Referring to Figure 1, an operating environment 100 for one embodiment includes at least one computer system 102. The computer system 102 may or may not be a multiprocessor computer system. The operating environment may include one or more machines within a given computer system, which may be clustered in a cloud, networked as client servers, and/or peer-to-peer. Individual machines are computer systems, and a group of collaborating machines is also a computer system. A given computer system 102 may be configured for, for example, end-users with applications, for administrators, as a server, as a distributed processing node, and/or otherwise.

人类用户104可以经由键入的文本、触摸、语音、移动、计算机视觉、手势、和/或其他形式的I/O,通过使用显示器、键盘和其他外围设备106与计算机系统102交互。屏幕126可以是可移动外围设备106,或者可以是系统102的组成部分。用户接口可以支持一个实施例与一个或多个人类用户之间的交互。用户接口可以包括命令行接口、图形用户界面(GUI)、自然用户界面(NUI)、语音命令界面、和/或其他用户界面(UI)呈现,它们可以作为不同的选项呈现或者可以集成。Human user 104 can interact with computer system 102 via typed text, touch, voice, mobile, computer vision, gestures, and/or other forms of I/O, using a display, keyboard, and other peripheral devices 106. Screen 126 may be a movable peripheral device 106 or may be an integral part of system 102. The user interface may support interaction between one embodiment and one or more human users. The user interface may include a command-line interface, a graphical user interface (GUI), a natural user interface (NUI), a voice command interface, and/or other user interface (UI) presentations, which may be presented as different options or may be integrated.

系统管理员、网络管理员、软件开发者、工程师和最终用户都是特定类型的用户104。代表一个或多个人的自动代理、脚本、回放软件等也可以是用户104。存储设备和/或网络设备在一些实施例中可以被视为外围设备,而在一些其他实施例中可以被视为系统102的一部分,这取决于它们与处理器110的可分离性。例如,图1中未示出的其他计算机系统可以使用经由网络接口设备与网络108的一个或多个连接以技术性方式与计算机系统102或与另一系统实施例交互。System administrators, network administrators, software developers, engineers, and end users are all specific types of users 104. Automated agents, scripts, playback software, etc., representing one or more individuals can also be users 104. Storage devices and/or network devices may be considered peripheral devices in some embodiments, while in other embodiments they may be considered part of system 102, depending on their separability from processor 110. For example, other computer systems not shown in FIG1 may technically interact with computer system 102 or another system embodiment using one or more connections to network 108 via network interface devices.

每个计算机系统102包括至少一个处理器110。与其他合适的系统一样,计算机系统102也包括一个或多个计算机可读存储介质112。介质112可以是不同的物理类型。介质112可以是易失性存储器、非易失性存储器、就地固定介质、可移动介质、磁性介质、光学介质、固态介质、和/或其他类型的物理持久性存储介质(与仅传播介质信号相反)。具体地,当插入或以其他方式安装时,诸如便携式(即,外部的)硬盘驱动器、CD、DVD、存储棒或其他可移动非易失性存储介质的经配置介质114可以在功能上成为计算机系统的技术性部分,使其内容是可访问的,以用于与处理器110交互并且由处理器110使用。可移动地配置的介质114是计算机可读存储介质112的示例。计算机可读存储介质112的其他一些示例包括内置的RAM、ROM、硬盘、以及由用户104不随时可拆卸的其他存储器存储设备。为了符合当前的美国专利要求,在美国未决或已批准的任何权利要求下,计算机可读介质、计算机可读存储介质、或计算机可读存储器都不是信号本身、或者仅能量。Each computer system 102 includes at least one processor 110. Like other suitable systems, computer system 102 also includes one or more computer-readable storage media 112. Media 112 can be of various physical types. Media 112 can be volatile memory, non-volatile memory, in-situ fixed media, removable media, magnetic media, optical media, solid-state media, and/or other types of physically persistent storage media (as opposed to media that merely transmits signals). Specifically, when inserted or otherwise installed, a configured medium 114, such as a portable (i.e., external) hard disk drive, CD, DVD, memory stick, or other removable non-volatile storage medium, can functionally become a technical part of the computer system, making its contents accessible for interaction with and use by the processor 110. Removably configured media 114 is an example of computer-readable storage media 112. Other examples of computer-readable storage media 112 include built-in RAM, ROM, hard disks, and other memory storage devices that are not readily removable by the user 104. To comply with current U.S. patent requirements, under any pending or granted claim in the United States, a computer-readable medium, a computer-readable storage medium, or a computer-readable memory is not a signal itself or merely energy.

例如,介质114配置有由处理器110可执行的二进制指令116;“可执行的”在本文中在广义上使用以包括机器代码、可解释代码、字节代码、和/或在虚拟机上运行的代码。介质114还配置有数据118,数据118通过指令116的执行而被创建、被修改、被引用、和/或以其他方式用于技术效果。指令116和数据118配置它们驻留在其中的存储器或其他存储介质114;当该存储器或其他计算机可读存储介质是给定计算机系统的功能部分时,指令116和数据118也配置该计算机系统。在一些实施例中,数据118的一部分代表真实世界项,诸如产品特性、库存、物理测量、设置、图像、读数、目标、体积(volume)等。这样的数据还会通过备份、还原、提交、中止、重新格式化、和/或其他技术性操作被转换。For example, medium 114 is configured with binary instructions 116 executable by processor 110; "executable" is used broadly herein to include machine code, interpreted code, bytecode, and/or code running on a virtual machine. Medium 114 is also configured with data 118, which is created, modified, referenced, and/or otherwise used for technical effects through the execution of instructions 116. Instructions 116 and data 118 configure the memory or other storage medium 114 in which they reside; when the memory or other computer-readable storage medium is a functional part of a given computer system, instructions 116 and data 118 also configure the computer system. In some embodiments, a portion of data 118 represents real-world items such as product characteristics, inventory, physical measurements, settings, images, readings, targets, volumes, etc. Such data may also be transformed through backup, restore, commit, abort, reformatting, and/or other technical operations.

尽管可以将一个实施例描述为由计算设备(例如,通用计算机、服务器或群集)中的一个或多个处理器执行的软件指令来实现,但是这种描述并不表示穷尽所有可能的实施例。本领域技术人员将理解,相同或相似的功能通常也可以直接在硬件逻辑中全部或部分地被实施以提供相同或相似的技术效果。备选地,或除了软件实现以外,本文中描述的技术功能性可以至少部分由一个或多个硬件逻辑组件执行。例如,并且在不排除其他实现的情况下,一个实施例可以包括硬件处理器110、128,诸如现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、系统片上组件(SOC)、复杂可编程逻辑设备(CPLD)和类似组件。例如,可以基于一个实施例的组件的输入、输出和/或它们的技术效果将它们分组为交互功能模块。While an embodiment can be described as being implemented by software instructions executed by one or more processors in a computing device (e.g., a general-purpose computer, server, or cluster), this description does not represent an exhaustive list of all possible embodiments. Those skilled in the art will understand that the same or similar functionality can often also be implemented directly in hardware logic, in whole or in part, to provide the same or similar technical effects. Alternatively, or in addition to software implementation, the technical functionality described herein can be performed at least in part by one or more hardware logic components. For example, and without excluding other implementations, an embodiment may include hardware processors 110, 128, such as field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip components (SOCs), complex programmable logic devices (CPLDs), and similar components. For example, components of an embodiment may be grouped into interactive functional modules based on their inputs, outputs, and/or their technical effects.

除了处理器110(例如,CPU、ALU、FPU和/或GPU)、存储器/存储介质112和显示器126以外,操作环境还可以包括其他硬件128,例如,诸如电池、总线、电源耗材、有线和无线网络接口卡。名词“屏幕”和“显示器”在本文中可互换使用。显示器126可以包括一个或多个触摸屏、响应于来自笔或平板电脑的输入的屏幕、或仅用于输出的屏幕。在一些实施例中,诸如人类用户I/O设备(屏幕、键盘、鼠标、平板电脑、麦克风、扬声器、运动传感器等)等的外围设备106将与一个或多个处理器110及存储器可操作通信。软件过程可以是用户104。In addition to processor 110 (e.g., CPU, ALU, FPU, and/or GPU), memory/storage medium 112, and display 126, the operating environment may also include other hardware 128, such as batteries, buses, power supplies, wired and wireless network interface cards. The terms "screen" and "display" are used interchangeably herein. Display 126 may include one or more touchscreens, a screen responsive to input from a pen or tablet, or a screen for output only. In some embodiments, peripheral devices 106, such as human user I/O devices (screen, keyboard, mouse, tablet, microphone, speaker, motion sensor, etc.), will be operatively communicating with one or more processors 110 and memory. The software process may be user 104.

在一些实施例中,该系统包括由网络108连接的多个计算机。联网接口设备可以使用诸如分组交换网络接口卡、无线收发器、或电话网络接口的组件(例如,它可以存在于给定计算机系统中)来来提供对网络108的访问权。然而,一个实施例还可以通过直接存储器访问、可移动非易失性介质、或其他信息存储检索和/或传输方法来传送技术数据和/或技术指令。In some embodiments, the system includes multiple computers connected by network 108. Networking interface devices may use components such as packet-switched network interface cards, wireless transceivers, or telephone network interfaces (e.g., these may be present in a given computer system) to provide access to network 108. However, one embodiment may also transmit technical data and/or technical instructions via direct memory access, removable non-volatile media, or other information storage, retrieval, and/or transmission methods.

本领域技术人员将理解,本文中在“操作环境”下呈现的前述方面和其他方面可以形成一个给定实施例的一部分。本文档的标题并非旨在将特征严格分类为实施例和非实施例特征集。Those skilled in the art will understand that the foregoing and other aspects presented herein in the context of an "operating environment" can form part of a given embodiment. The headings of this document are not intended to strictly categorize features into sets of features specific to embodiments and non-embodiments.

一个或多个项在附图中以虚线形式示出,或者在括号内列出,以强调它们不一定是所示操作环境的一部分或所有实施例的一部分,而是可以与操作环境中的项或本文中讨论的一些实施例互操作。在任何附图或任何实施例中,并不必然要求非虚线或括号形式的项是必需的。特别是,图1是为了方便起见而提供的;在图1中包括项并不表示该项或该项的所描述的用途是在本发明之前已知的。One or more items are shown in dashed lines in the accompanying drawings, or listed in parentheses, to emphasize that they are not necessarily part of the illustrated operating environment or all embodiments, but may interoperate with items in the operating environment or some embodiments discussed herein. Items not shown in dashed lines or parentheses are not necessarily required in any drawing or any embodiment. In particular, Figure 1 is provided for convenience; the inclusion of an item in Figure 1 does not imply that the item or its described use was known prior to the invention.

调试环境Debugging environment

图2示出了实时过程调试环境,其是操作环境100的一个示例。调试器200包含各种组件,很多组件未在这里示出,因为很多是众所周知的。如本文中教导的执行控制的主要用途可以是在其中实时过程调试不可行或至少不被期望的环境中。尽管如此,仍针对上下文以及因为它可以与利用本文教导的执行控制的基于跟踪的调试组合而示出了实时过程调试。Figure 2 illustrates a real-time process debugging environment, which is an example of operating environment 100. Debugger 200 contains various components, many of which are not shown here because many are well-known. The primary use of execution control, as taught herein, can be in environments where real-time process debugging is infeasible or at least undesirable. Nevertheless, real-time process debugging is shown for the context and because it can be combined with trace-based debugging utilizing the execution control taught herein.

调试器200可以是传统调试器,或者可以被适配于执行本文中教导的执行控制。所示的调试器包括数据访问组件208(DAC)。在该实时调试1428环境中,通过使用对运行时的主请求214和来自运行时的主响应216,DAC 208与实时调试对象202的运行时204通信,以获取存储器项206。然后,调试器相应地更新其用户界面210。用户界面在相对高级别(例如就在源代码212中定义的工件方面)处呈现状态信息。然而,本领域技术人员将理解,如本文中教导的执行控制不需要DAC 208或其他适配器。Debugger 200 can be a conventional debugger or can be adapted to perform the execution control taught herein. The debugger shown includes a data access component 208 (DAC). In this real-time debugging 1428 environment, DAC 208 communicates with the runtime 204 of the real-time debug object 202 to obtain memory items 206 by using a master request 214 to the runtime and a master response 216 from the runtime. The debugger then updates its user interface 210 accordingly. The user interface presents status information at a relatively high level (e.g., in terms of artifacts defined in source code 212). However, those skilled in the art will understand that the execution control taught herein does not require DAC 208 or other adapters.

图3示出了转储调试环境,其是操作环境100的另一示例。调试器200使用其数据访问组件208或功能性相似的代码从转储文件302或快照304或这两者读取存储器内容以及在调试对象的执行中的特定时间点的其他状态信息。Figure 3 illustrates a dump debugging environment, which is another example of operating environment 100. Debugger 200 uses its data access component 208 or functionally similar code to read memory contents from dump file 302 or snapshot 304, or both, as well as other state information at specific points in time during the execution of the debugged object.

图4示出了基于跟踪的调试环境,其是操作环境100的另一示例。所示的调试器200与技术性适配配合使用或包括(因为调试器的范围可以例如由给定开发者定义为包括重放适配器408)技术性适配,该技术性适配准许调试器或多或少地与跟踪418交互,就如同调试器正在与运行时交互一样。例如,在该示例中,相同的格式可以被用于在图2的实时过程调试环境中使用的主请求214和主响应216。然而,基于跟踪的调试1428可以为开发者提供比实时过程调试少的灵活性,因为通过运行时可访问的变量和其他存储器内容不一定是从跟踪可读取的。利用熟悉的基于跟踪的调试器的执行控制粒度也可以大于通过本文所提供的教导可获取的粒度。更精细的粒度可以在调试期间提供更好的控制,从而可以加快缺陷位置标识和对缺陷的理解。Figure 4 illustrates a trace-based debugging environment, another example of operating environment 100. The debugger 200 shown is used in conjunction with or includes (since the scope of the debugger can be defined by a given developer, for example, to include replay adapter 408) a technical adapter that allows the debugger to interact with trace 418 more or less as if the debugger were interacting with the runtime. For example, in this example, the same format could be used for the main request 214 and main response 216 used in the real-time process debugging environment of Figure 2. However, trace-based debugging 1428 can offer developers less flexibility than real-time process debugging because variables and other memory contents accessible through the runtime are not necessarily readable from the trace. The granularity of execution control using a familiar trace-based debugger can also be greater than the granularity available through the teachings presented herein. Finer granularity can provide better control during debugging, thereby accelerating defect location identification and understanding of defects.

具有合适的执行控制402代码、重放组件406、以及跟踪数据与源代码212之间的映射404的基于跟踪的调试可以以所跟踪的执行的反向重放的形式来支持反向执行1422。相反,在实时调试中,调试对象通常不会反向执行。Tracing-based debugging, with appropriate execution control code 402, a replay component 406, and a mapping 404 between tracing data and source code 212, can support reverse execution 1422 in the form of a reverse replay of the traced execution. In contrast, in real-time debugging, the debugged object is typically not reverse executed.

所示的重放适配器408包括与调试器的接口410,在该示例中,该接口向调试器呈现API,该API与由运行时204呈现给传统调试器的API的至少子集相匹配,以支持实时过程调试1428。其他实现方法也是可能的。而且,如图4中的重放适配器408周围的虚线所示,在一些实现中,一些或全部重放适配器可以被认为是调试器200的一部分,因为调试器是包含利用一个或多个跨级别映射404的代码的适配调试器200。例如,与使用外部消息相反,一个变型将主请求214和主响应216以及接口410实施为调试器内的函数调用、返回以及接口。在一些变型中,调试器包含并且利用跨级别映射404,并且不存在单独的重放适配器408。调试器DAC 208可以用于将地址448映射到高级别对象512。调试器跨级别映射404及其相关联的代码(即,执行控制器402、重放组件406和重放适配器408中的一个或多个)可以用于将源代码语句218或表达式220或这两者映射到特定本机指令434或本机指令组822。在一些实施例中,类似于转储调试,DAC 208具有运行时的内部知识,并且可以读取运行时数据结构以确定JIT原始代码对于给定的IL指令的集合被定位于何处。在其上运行调试对象的机器架构可以与在其上运行调试器的机器架构显著不同,但是DAC可以被设计为读取运行时的数据结构并且处理硬件/运行时差异。The replay adapter 408 shown includes an interface 410 to the debugger, which in this example presents an API to the debugger that matches at least a subset of the APIs presented to a traditional debugger by runtime 204 to support real-time process debugging 1428. Other implementations are also possible. Moreover, as shown by the dashed lines around the replay adapter 408 in Figure 4, in some implementations, some or all of the replay adapters can be considered part of the debugger 200, since the debugger is an adapted debugger 200 containing code that utilizes one or more cross-level mappings 404. For example, instead of using external messages, one variant implements the main request 214 and main response 216, as well as interface 410, as function calls, returns, and interfaces within the debugger. In some variants, the debugger includes and utilizes the cross-level mapping 404, and there is no separate replay adapter 408. Debugger DAC 208 can be used to map address 448 to higher-level object 512. The debugger cross-level mapping 404 and its associated code (i.e., one or more of the execution controller 402, replay component 406, and replay adapter 408) can be used to map source code statements 218 or expressions 220, or both, to specific native instructions 434 or native instruction sets 822. In some embodiments, similar to dump debugging, the DAC 208 has runtime internal knowledge and can read runtime data structures to determine where the JIT source code is located for a given set of IL instructions. The machine architecture on which the debug object runs can be significantly different from the machine architecture on which the debugger runs, but the DAC can be designed to read runtime data structures and handle hardware/runtime differences.

图4以机器级别请求414和响应416的形式示出了重放组件406与跟踪418之间的通信。这是一种可能的实现,作为示例,其可以使用跟踪读取器(未示出)来接收并且响应于请求。然而,在另一种实现中,机器级别请求414和响应416采用重放适配器408内的函数调用的形式,其中包括从跟踪418读取并且传递回在跟踪中找到的其调用者信息的函数,因此,重放组件可以维持当前状态信息,诸如由当前指令指针704标识的跟踪418中的哪个位置。Figure 4 illustrates the communication between the replay component 406 and the trace 418 in the form of a machine-level request 414 and a response 416. This is one possible implementation, as an example, which could use a trace reader (not shown) to receive and respond to the request. However, in another implementation, the machine-level request 414 and response 416 take the form of function calls within the replay adapter 408, which include functions that read from the trace 418 and pass back their caller information found in the trace. Thus, the replay component can maintain current state information, such as which position in the trace 418 is identified by the current instruction pointer 704.

如图所示,跟踪418可以被存储在一个或多个文件420中,并且可以包括各种类型的跟踪数据、以及支持或界定对跟踪数据的搜索的元数据。跟踪418的部分或全部也可以驻留在RAM中。跟踪数据的一些示例包括精确到位的跟踪数据422(诸如低级别指令及其操作数(也称为“本机指令”)的副本)、可以用于使跟踪数据项相对于彼此而排序的时间码424、存储器快照304或转储文件302、到原始跟踪数据中的索引430、以所指明的间隔被插入到原始跟踪数据中的关键帧432、由调试对象在跟踪期间执行1422的代码434的副本、堆栈活动436、由调试对象在跟踪时读取或写入的数据流438、以每个核心440或每个插槽(多个核心)442为基础的处理器活动、在跟踪时的线程活动444、在跟踪时的寄存器读取和写入446、将存储器地址448与指令450和一个或多个值452以及可选地还与时间码424相关联的元组456、以及在跟踪中捕获的其他454读取或写入或值或操作码。在一些实施例中,项216、422、434、436、438、440、442、444、446、456中的任何一个项的实例都符合跟踪“条目”458。在一些中,本身表示所跟踪的程序的状态改变的跟踪数据454的任何最小部分符合跟踪“条目”458。跟踪中缺少一些数据也可以被认为是状态信息,例如时间码序列中的间隙428。As shown in the figure, trace 418 can be stored in one or more files 420 and can include various types of trace data, as well as metadata that supports or defines the search for the trace data. Some or all of trace 418 can also reside in RAM. Some examples of trace data include precisely located trace data 422 (such as copies of low-level instructions and their operands (also known as "native instructions")), timecode 424 which can be used to sort trace data items relative to each other, memory snapshot 304 or dump file 302, index 430 into the original trace data, keyframes 432 inserted into the original trace data at specified intervals, copies of code 434 executed by the debug object during trace 1422, stack activity 436, data streams 438 read or written by the debug object during trace, processor activity based on per core 440 or per socket (multiple cores) 442, thread activity during trace 444, register reads and writes during trace 446, tuples 456 that associate memory address 448 with instruction 450 and one or more values 452 and optionally also with timecode 424, and other 454 reads or writes or values or opcodes captured during trace. In some embodiments, an instance of any one of items 216, 422, 434, 436, 438, 440, 442, 444, 446, 456 conforms to trace “entry” 458. In some, any minimal portion of trace data 454 that itself represents a change in the state of the traced program conforms to trace “entry” 458. Missing data in the trace can also be considered state information, such as gaps 428 in the timecode sequence.

图5示出了根据本文中的教导的可以被跟踪并且因此受制于值或分配状态的变化的各种存储器112,值或分配状态的变化在执行1422控制下由本机指令的执行来进行。所示的存储器单元502的示例包括堆栈504(包括诸如其基地址506和所分配的堆栈帧508的数据)、诸如对象512的堆内容510、或诸如垃圾收集数据的元数据、高速缓存514、处理器寄存器516、诸如属性518的对象成员、ROM 520或RAM 524中的可寻址单元、可移动或第三层存储器522、本地存储器526和全局存储器528。存储器单元可以具有一个或多个特性530,特性530增加或减少存储器单元的可访问性,例如,存储器可以在内核空间中、可以被共享、可以进行DMA、等等。Figure 5 illustrates various memories 112 that can be tracked and thus subject to changes in value or allocation state according to the teachings herein, changes in value or allocation state being performed by the execution of native instructions under the control of execution 1422. Examples of memory cells 502 shown include stack 504 (including data such as its base address 506 and allocated stack frames 508), heap contents 510 such as object 512, or metadata such as garbage collection data, cache 514, processor registers 516, object members such as attribute 518, addressable units in ROM 520 or RAM 524, removable or third-level memory 522, local memory 526, and global memory 528. Memory cells may have one or more characteristics 530 that increase or decrease the accessibility of the memory cell, for example, the memory may be in kernel space, may be shared, may be DMA-enabled, etc.

图6示出了机器级别请求414的内容。如上所述,这些请求可以使用通信数据结构而被实施,或者他们可以被实施为例程的参数。机器级别请求414中的内容的一些示例是存储器单元规定602和一个或多个执行时间点616的规定608。存储器单元502可以被指明为例如单个地址448、地址的范围606、或者寄存器名称604。时间码424可以被指明为例如指令计数610或者系统时钟值612,并且该规定可以针对单个特定执行时间点616(跟踪期间的点,或特定本机指令)或执行时间的范围614(即,跟踪期间的执行1422时间的跨度或期间或间隔,或者一组连续本机指令)。Figure 6 illustrates the contents of machine-level request 414. As mentioned above, these requests can be implemented using communication data structures, or they can be implemented as parameters of a routine. Some examples of the contents of machine-level request 414 are a memory cell specification 602 and a specification 608 of one or more execution time points 616. Memory cell 502 can be specified as, for example, a single address 448, an address range 606, or a register name 604. Time code 424 can be specified as, for example, an instruction count 610 or a system clock value 612, and this specification can be for a single specific execution time point 616 (a point during trace, or a specific native instruction) or a range of execution time 614 (i.e., the span or period or interval of execution time during trace, or a set of consecutive native instructions).

图7示出了机器级别请求响应416的内容。如上所述,这些请求响应可以使用通信数据结构而被实施,或者他们可以被实施为例程的函数返回值或副作用。机器级别请求响应416中的内容的一些示例是:针对在对应的请求414中所指明的一个或多个存储器单元的值702;指示接下来哪个指令将执行(或哪个指令刚刚完成执行1422)的指令指针704;以及状态码706,其包含例如与指令、或者错误、或者条件(诸如文件结束符(end-of-file))相关联的标志。每个线程可以具有相应指令指针704。Figure 7 illustrates the contents of machine-level request response 416. As mentioned above, these request responses can be implemented using communication data structures, or they can be implemented as routine function return values or side effects. Some examples of the contents of machine-level request response 416 are: a value 702 for one or more memory locations specified in the corresponding request 414; an instruction pointer 704 indicating which instruction will be executed next (or which instruction has just finished executing 1422); and a status code 706 containing flags associated, for example, with an instruction, or an error, or a condition (such as an end-of-file marker). Each thread may have a corresponding instruction pointer 704.

一些跟踪重放执行控制系统Some tracking and replay execution control systems

图8示出了跟踪重放执行控制系统800,每个跟踪重放控制系统800是根据本文中提供的执行教导而配置的系统102。如果执行控制系统在实时调试环境中操作,则它包含具有可调用运行时204的调试对象程序124。尽管以调试为例,但是执行控制也可以如本文中在其他上下文中所教导的那样执行,例如,用于性能分析或软件运行状况监测。调试对象或其他被重放的程序包括一个或多个过程802,每个过程可以包括一个或多个线程804。本领域技术人员可以理解,术语“过程”和“线程”以不同的方式被使用,例如有时用作彼此的同义词,有时具有不同的含义。无论哪种方式,都可以应用本文中提供的执行控制教导,因为在“过程”和“线程”这两个含义的任何一个含义下,过程802和线程804都具有对应的源代码212和对应的所跟踪的指令434。Figure 8 illustrates a trace replay execution control system 800, each of which is a system 102 configured according to the execution teachings provided herein. If the execution control system operates in a real-time debugging environment, it contains a debug object program 124 with a callable runtime 204. Although debugging is used as an example, execution control can also be performed as taught herein in other contexts, such as for performance analysis or software health monitoring. The debug object or other replayed program includes one or more processes 802, each of which may include one or more threads 804. Those skilled in the art will understand that the terms “process” and “thread” are used in different ways, for example, sometimes as synonyms for each other, and sometimes with different meanings. In either case, the execution control teachings provided herein can be applied because, under either meaning of “process” or “thread,” process 802 and thread 804 have corresponding source code 212 and corresponding traced instructions 434.

无论重放执行是否在实时调试环境中进行,都随着重放执行“进行”来维护和更新被重放的程序的状态信息。从这个意义上讲,进行操作包括向前执行、向后执行或这两者。状态信息包括例如指示跟踪418中的(多个)执行时间点的一个或多个指令指针值、以及在跟踪418中所捕获的所跟踪的程序变量值变化。为了指示状态信息的存在,针对(多个)过程802的框在图8中在调试对象程序124框内部以实线而不是虚线示出。然而,本领域技术人员将认识到,状态信息也可以被维持在执行控制器402内部或系统800中的一个或多个其他位置处。Regardless of whether replay execution occurs in a real-time debugging environment, the state information of the replayed program is maintained and updated as the replay execution "proces." In this sense, "procesuspension" includes forward execution, backward execution, or both. State information includes, for example, one or more instruction pointer values indicating execution time(s) in trace 418, and changes in traced program variable values captured in trace 418. To indicate the presence of state information, the boxes for process(s) 802 are shown in FIG. 8 inside the debug object program 124 box with solid lines instead of dashed lines. However, those skilled in the art will recognize that state information may also be maintained within execution controller 402 or at one or more other locations within system 800.

执行控制器402本身包括使用处理器110和存储器112所执行的软件。所跟踪的程序124是具有源代码212和元数据808的其他软件。执行控制器402使用源中间映射810在源代码212与该源代码的中间表示826之间进行映射。执行控制器402还使用中间本机映射812在中间表示826与跟踪418(包括从跟踪收集的本机指令的记录814)之间进行映射。这些映射810、812在本文中统称为“跨级别映射”。注意,一个给定实施例可以包括一个或多个跨级别映射404,例如,可以将源到中间和中间到本机的功能性集成到单个源到本机映射404中。The execution controller 402 itself includes software executed using processor 110 and memory 112. The traced program 124 is other software having source code 212 and metadata 808. The execution controller 402 uses a source intermediate map 810 to map the source code 212 to an intermediate representation 826 of that source code. The execution controller 402 also uses an intermediate native map 812 to map the intermediate representation 826 to the trace 418 (including a record 814 of native instructions collected from the trace). These maps 810, 812 are collectively referred to herein as “cross-level maps”. Note that a given embodiment may include one or more cross-level maps 404; for example, source-to-intermediate and intermediate-to-native functionality may be integrated into a single source-to-native map 404.

在一些情况下,例如在.NET语言的情况下,由编译器创建源到IL映射810。然而,可以直接执行源语言的运行时204是存在的;其中一个示例是(甲骨文美国公司的商标)。在这种情况下,运行时本身会将语言编译为中间格式,并且同时创建源到IL映射。在与.NET语言类似的被管理语言的情况下,高级别语言编译器不执行IL本机映射;相反,运行时204中的JIT编译器这样做。编译为本机代码的编译器也不会进行IL本机映射。实际上,如果这样的编译器具有任何形式的IL,则很可能是该编译器的实现细节。在一些实施例中,执行控制利用由运行时生成的IL本机映射812。In some cases, such as in the case of .NET languages, the compiler creates the source-to-IL mapping 810. However, there are runtimes 204 that can directly execute the source language; one example is (a trademark of Oracle Corporation). In this case, the runtime itself compiles the language to an intermediate format and simultaneously creates the source-to-IL mapping. In the case of managed languages similar to .NET languages, the high-level language compiler does not perform native IL mapping; instead, the JIT compiler in runtime 204 does. Compilers that compile to native code also do not perform native IL mapping. In fact, if such a compiler has any form of IL, it is likely an implementation detail of that compiler. In some embodiments, execution control utilizes the native IL mapping 812 generated by the runtime.

一些实现从跟踪本机指令获取所生成的IL。例如,一些实现通过仿真模拟CPU来工作,并且使用本机指令来回放跟踪。在一些情况下,IL独身不是足以重新创建本机指令的信息。在一些中,本机指令本身不足以实现IL步进或IL断点。另外,本机指令与IL指令之间的映射被使用。一些实施例在不依赖于本机指令(甚至可能不存在于跟踪中)的情况下使用映射,以使用不依赖于了解本机指令的跟踪重放器来实现支持逐步通过IL代码的调试器。这样的实现可以通过在映射中所提供的范围或者通过所指明的项的任何连续或非连续收集来追踪指令指针。Some implementations obtain the generated IL from tracing native instructions. For example, some implementations simulate CPU operation by emulating it and use native instructions to replay the tracing. In some cases, the IL alone is not sufficient information to recreate the native instructions. In some cases, the native instructions themselves are insufficient to implement IL stepping or IL breakpoints. Additionally, a mapping between native and IL instructions is used. Some embodiments use mappings without relying on native instructions (which may not even exist in the tracing) to implement debuggers that support stepping through IL code using a tracing replayer that does not rely on knowledge of native instructions. Such implementations can trace the instruction pointer by the range provided in the mapping or by any consecutive or non-consecutive collection of the specified items.

关于跨级别映射的补充Supplement on cross-level mapping

为了进一步说明跨级别映射404,考虑以下示例:一些源代码212、用作中间表示826的一些对应中间语言代码的一部分、以及一些本机指令的一部分。由于专利局对专利文件中包含计算机代码的限制,并且由于示出一部分足以在本文中提供的其他信息和本领域普通技术人员知识的上下文中说明映射404,因此这里仅示出中间语言代码和本机指令的部分。To further illustrate the cross-level mapping 404, consider the following example: some source code 212, a portion of some corresponding intermediate language code used as intermediate representation 826, and a portion of some native instructions. Due to the patent office's restrictions on the inclusion of computer code in patent documents, and because showing a portion is sufficient to illustrate mapping 404 in the context of the other information provided herein and the knowledge of a person skilled in the art, only portions of the intermediate language code and native instructions are shown here.

原始C#源代码:Original C# source code:

样本源到IL映射。该样本是手工生成的。实际实现通常是人类不可读的。也就是说,源到IL映射通常将以二进制格式而不是文本格式被实施。尽管如此,下面的材料还是向本领域技术人员说明了源到IL映射功能性。映射不是一对一映射,源代码行的一些部分在IL代码中的不同位置结束。对于单个源程序,有很多正确生成的IL转换。Sample source-to-IL mapping. This sample is hand-generated. The actual implementation is typically unreadable to humans. That is, the source-to-IL mapping will usually be implemented in binary format rather than text format. Nevertheless, the following material illustrates the functionality of the source-to-IL mapping to those skilled in the art. The mapping is not a one-to-one mapping; some parts of the source code line end at different locations in the IL code. For a single source program, there are many correctly generated IL transformations.

样本IL到本机映射。与源到IL映射一样,这是手工生成的,并且实现将作为数据结构存在,例如在运行时中。对于单个生成的IL,有很多正确生成的本机代码转换。由于JIT编译器可能会因特定于处理器的优化而增加复杂性,并且由于使用跟踪的程序的调试1428可能不会在同一处理器类型上执行(即,将应用不同的优化),因此不能简单地在IL上运行JIT并且不能确保与在跟踪418的生成期间运行的结果相同。在该示例中,IL以“IL_”开头,并且本机被表示为<memory address><hexadecimal representation of native code><assembly mnemonic>。Sample IL to native mapping. Similar to source-to-IL mapping, this is manually generated, and the implementation will exist as a data structure, for example, at runtime. For a single generated IL, there are many correctly generated native code transformations. Because the JIT compiler can add complexity due to processor-specific optimizations, and because debug 1428 using traced programs may not execute on the same processor type (i.e., different optimizations will be applied), it is not simply possible to run the JIT on the IL and the result cannot be guaranteed to be the same as running it during the generation of trace 418. In this example, the IL begins with "IL_", and the native code is represented as <memory address><hexadecimal representation of native code><assembly mnemonic>.

通常,存在内核120,并且在图8中明确示出了内核120,以帮助防止运行时204与内核120之间的混淆。本文所述的跨级别映射和执行控制假定在大多数(如果不是全部)配置中当执行被跟踪以创建跟踪418时存在运行时。Typically, kernel 120 is present, and is explicitly shown in Figure 8 to help prevent confusion between runtime 204 and kernel 120. The cross-level mapping and execution control described herein assume that the runtime is present in most (if not all) configurations when execution is traced to create trace 418.

系统800和相关系统的附加方面Additional aspects of System 800 and related systems

系统800的一些实施例包括用于动态地编译所跟踪的程序124的代码的JIT编译器816。执行控制的一些方面例如通过支持断点范围830来解决由JIT编译所创建的挑战,即使尚未由编译生成跨越断点的位置的本机代码,只要知道将包含所生成的代码的地址范围,上述断点范围830就允许断点被遇到。例如,断点范围830可以被指明为范围606或614,而个体断点828被指明为跟踪418中的特定单个位置。Some embodiments of system 800 include a JIT compiler 816 for dynamically compiling the code of the traced program 124. Some aspects of execution control address the challenges created by JIT compilation, for example, by supporting breakpoint ranges 830, which allow breakpoints to be encountered even if native code spanning the breakpoint location has not yet been generated by compilation, provided the address range that will contain the generated code is known. For example, breakpoint range 830 can be specified as ranges 606 or 614, while individual breakpoints 828 are specified as specific single locations within trace 418.

继续参考图8,系统800的一些实施例包括调用818的返回地址820。例如,当执行其在反向执行中步进退出调用例程的反向步进退出执行控制操作时,可以使用该返回地址820。Referring again to Figure 8, some embodiments of system 800 include a return address 820 for call 818. This return address 820 may be used, for example, when performing a reverse step-out execution control operation that steps out of the calling routine during reverse execution.

一些实施例通过提供源代码语句或表达式与实现它们的所跟踪的指令之间的更精确的对应关系来提高执行控制的准确性。例如跟踪重放的一些熟悉的方法步进进入与给定源代码语句218或表达式220相对应的所跟踪的指令的中间,这可能造成混乱。本文所述的一些实施例肯定地定义了与给定源代码语句218或表达式220相对应的(例如,由编译而生成以实现)的一组822所跟踪的指令。然后,执行控制器设置指向该组822的边缘824处的位置的指令指针,而不是像以前那样在中间某处。哪个边缘824被选择可以取决于执行是向前重放还是向后重放,例如,选择第一向前边缘用于向前重放,并且选择第一向后边缘用于向后重放。备选地,可以始终使用相同的边缘,而不管重放方向如何,例如,始终将指令指针设置在第一向前边缘处。Some embodiments improve the accuracy of execution control by providing a more precise correspondence between source code statements or expressions and the traced instructions that implement them. For example, some familiar methods of tracing replay step into the middle of the traced instructions corresponding to a given source code statement 218 or expression 220, which can be confusing. Some embodiments described herein definitively define a set of 822 traced instructions corresponding to a given source code statement 218 or expression 220 (e.g., generated by compilation to implement). The execution controller then sets the instruction pointer to a location at an edge 824 of this set of 822, instead of somewhere in the middle as before. Which edge 824 is selected can depend on whether the execution is replaying forward or backward; for example, a first forward edge is selected for forward replay, and a first backward edge is selected for backward replay. Alternatively, the same edge can always be used regardless of the replay direction; for example, the instruction pointer can always be set at the first forward edge.

图9示出了若干执行控制操作618。例如,由用户通过用户界面210将控制操作请求806呈现给调试器200或其他工具122。执行控制器402将控制操作请求806转换为过程802的状态的变化。所示的操作包括向前步进902、向前步进进入904、向前步进跳过906、向前步进退出908、继续向前910、向后步进912、向后步进进入914、向后步进跳过916、向后步进退出918、继续向后920、设置断点范围922、以及设置断点924。在这些操作名称中,“向前”表示向前执行重放,并且“向后”表示向后执行重放。Figure 9 illustrates several execution control operations 618. For example, a user presents a control operation request 806 to the debugger 200 or other tool 122 via user interface 210. Execution controller 402 translates the control operation request 806 into a change in the state of process 802. The operations shown include forward step 902, forward step into 904, forward step skip 906, forward step out 908, continue forward 910, backward step 912, backward step into 914, backward step skip 916, backward step out 918, continue backward 920, set breakpoint range 922, and set breakpoint 924. In these operation names, "forward" indicates performing replay forward, and "backward" indicates performing replay backward.

各种步进操作902-920可以被实现,以便从开发者的角度来看,以与熟悉的相似或相同命名的操作相似或相同的方式操作。然而,例如,在内部,它们可以通过用于使用跨级别映射404、指令组822和特定断点放置将源代码与跟踪对准的创新来被实现。继续操作910、920也可以被实现,以便从开发者的角度来看,以与熟悉的继续操作相似或相同的方式操作,而在内部,它们利用跨级别映射404或指令组822或这两者。设置断点操作924也可以被实现,以便从开发者的角度来看,以与开发者设置断点的熟悉操作相似或相同的方式操作,而在内部,它利用跨级别映射404或指令组822或这两者。Various step operations 902-920 can be implemented so that, from the developer's perspective, they operate in a manner similar to or identical to familiar operations with similar or identical names. However, internally, for example, they can be implemented through innovations for aligning source code with traces using cross-level mapping 404, instruction group 822, and specific breakpoint placement. Continue operations 910, 920 can also be implemented so that, from the developer's perspective, they operate in a manner similar to or identical to familiar continue operations, while internally, they utilize cross-level mapping 404 or instruction group 822, or both. Set breakpoint operation 924 can also be implemented so that, from the developer's perspective, it operates in a manner similar to or identical to the familiar breakpoint setting operation, while internally, it utilizes cross-level mapping 404 or instruction group 822, or both.

图10示出了可以在给定跟踪418中被捕获的线程804活动信息444。示出了线程标识符1004、线程状态指示1006、线程的可执行代码1008、以及存储器单元502状态信息1010诸如线程局部变量及其标识符。Figure 10 illustrates the thread 804 activity information 444 that can be captured in a given trace 418. It shows the thread identifier 1004, thread state indication 1006, thread executable code 1008, and memory unit 502 status information 1010 such as thread local variables and their identifiers.

图11示出了中间表示826的一些示例。所示出的示例包括符号表1102,符号表1102将源代码标识符1104(变量名、函数名、对象成员和方法名等)与数据类型1106(例如整数、浮点、字符串、布尔值和用户定义的类型)相关联。另一示例是抽象语法树1108。其他一些示例包括以一种或多种中间语言1110编写的代码1112。更一般地,一些实施例使用中间表示826,该中间表示826共享由编译器创建的中间表示的结构或甚至是其副本。然而,中间表示826被放置在与编译器的上下文相反的执行控制器的上下文中。而且,中间表示826被用于先前生成的代码的执行跟踪418的跟踪重放,而不是首先用于生成该代码。Figure 11 illustrates some examples of intermediate representation 826. Examples shown include symbol table 1102, which associates source code identifiers 1104 (variable names, function names, object members, and method names, etc.) with data types 1106 (e.g., integers, floating-point numbers, strings, booleans, and user-defined types). Another example is abstract syntax tree 1108. Other examples include code 1112 written in one or more intermediate languages 1110. More generally, some embodiments use intermediate representation 826 that shares the structure of an intermediate representation created by the compiler, or even a copy thereof. However, intermediate representation 826 is placed in the context of an execution controller, opposite to the compiler's context. Furthermore, intermediate representation 826 is used for tracing replay of the execution tracing 418 of previously generated code, rather than being used to generate that code in the first place.

技术人员将认识到,给定源代码212可以潜在地用于生成对应的IL的很多不同版本。然而,这些版本中只有一个版本会在程序中被使用,并且由编译器发出的符号信息将与所发出的IL相对应。调试器可以被设计为仅加载对应的符号信息,因此将仅存在一个映射。在一些系统中,运行时可以包括针对给定例程的本机代码的多个版本,例如,用于调试的本机代码的优化生产版本和非优化版本可以都存在,或者多层JIT功能性可以提供存储器中的本机代码的多个版本。在这样的多本机版本系统中,重放仍然可以被完成。例如,当断点被设置时,其可以在本机代码的所有现存版本中被设置。一些实施例使用由JIT生成的本机代码以及IL代码,它们是从或经由跟踪418所获取的。一些实施例还使用对应的符号信息用于源/IL映射,该映射可以或可以不被包含在同一跟踪文件420中。A technician will recognize that a given source code 212 can potentially be used to generate many different versions of the corresponding IL. However, only one of these versions will be used in the program, and the symbol information emitted by the compiler will correspond to the emitted IL. The debugger can be designed to load only the corresponding symbol information, so only one mapping will exist. In some systems, the runtime may include multiple versions of native code for a given routine; for example, both optimized and non-optimized versions of native code for debugging may exist, or multi-level JIT functionality may provide multiple versions of native code in memory. In such a multi-native version system, replay can still be performed. For example, when a breakpoint is set, it can be set in all existing versions of the native code. Some embodiments use native code generated by the JIT as well as IL code, which are obtained from or via trace 418. Some embodiments also use the corresponding symbol information for the source/IL mapping, which may or may not be included in the same trace file 420.

图12是图2的变型。在图12的环境中,实时调试和重放执行两者被支持。重放由滚动跟踪418支持,滚动跟踪418实时记录实时调试对象的向前执行,而调试对象按照调试器200的提示执行。为了提高效率,仅使用例如一对缓冲器来跟踪最新指令。跟踪418被写入一个缓冲器直到其满,然后再被写入另一缓冲器直到其满,然后再被写回第一缓冲器(覆写较早的跟踪),以此类推。备选地,代替滚动窗口,调试1428会话期间的所有执行活动可以被跟踪。作为另一替代,可以在实时调试会话期间访问先前所记录的跟踪418。Figure 12 is a variation of Figure 2. In the environment of Figure 12, both real-time debugging and replay execution are supported. Replay is supported by a scrolling trace 418, which records the forward execution of the real-time debug object in real time, while the debug object executes according to the prompts of debugger 200. For efficiency, only, for example, a pair of buffers is used to track the latest instructions. Trace 418 is written to one buffer until it is full, then to another buffer until it is full, then written back to the first buffer (overwriting the earlier trace), and so on. Alternatively, instead of the scrolling window, all execution activity during the debug 1428 session can be tracked. As another alternative, previously recorded trace 418 can be accessed during the real-time debug session.

一些附加系统示例Some additional system examples

本文中提供了示例以帮助说明技术的各个方面,但是本文档内给出的示例并未描述所有可能的实施例。实施例不限于本文中提供的特定实现、布置、显示、特征、方法或场景。给定实施例可以包括例如附加的或不同的技术特征、机制、序列或数据结构,并且可以以其他方式背离本文中提供的示例。Examples are provided in this document to help illustrate various aspects of the technology; however, the examples given in this document do not describe all possible embodiments. Embodiments are not limited to the specific implementations, arrangements, displays, features, methods, or scenarios provided herein. A given embodiment may include, for example, additional or different technical features, mechanisms, sequences, or data structures, and may otherwise deviate from the examples provided herein.

参考图1-图2,一些实施例使用或提供跟踪重放执行控制系统800。该系统包括处理器110、与处理器可操作通信的存储器112、以及结合运行时204和内核120在程序124的执行期间被记录的跟踪418。跟踪包括由在程序的至少一个线程804中执行的本机代码指令116的记录814。还存在程序的至少一部分的源代码212。Referring to Figures 1-2, some embodiments use or provide a trace replay execution control system 800. This system includes a processor 110, a memory 112 operatively communicative to the processor, and a trace 418 recorded during the execution of program 124 in conjunction with runtime 204 and kernel 120. The trace includes a record 814 of native code instructions 116 executed in at least one thread 804 of the program. Source code 212 of at least a portion of the program is also present.

系统800还包括在源代码与源代码的中间表示826之间进行映射的源中间映射810、以及在中间表示826与跟踪418之间进行映射的中间本机映射812。System 800 also includes a source intermediate mapping 810 that maps between source code and intermediate representation 826 of source code, and an intermediate native mapping 812 that maps between intermediate representation 826 and trace 418.

系统800还包括软件工具122中的执行控制器402。执行控制器被配置为在利用处理器执行时响应于请求806而控制跟踪418的重放执行。在重放执行中,源代码通过源中间映射和中间本机映射与跟踪本机代码指令或其他跟踪条目相关联。System 800 also includes an execution controller 402 in software tool 122. The execution controller is configured to control the replay execution of trace 418 in response to request 806 when executed using the processor. In the replay execution, the source code is associated with trace native code instructions or other trace entries through source intermediate maps and intermediate native maps.

在一些实施例中,执行控制器402被配置为将针对至少以下操作618的请求转换为跟踪本机代码指令的对应执行:向前执行步进进入904操作、向前执行步进退出908操作、以及向前执行步进跳过906操作。In some embodiments, the execution controller 402 is configured to translate a request for at least the following operations 618 into corresponding execution of trace native code instructions: forward execution step into 904 operation, forward execution step out 908 operation, and forward execution step skip 906 operation.

在一些实施例中,执行控制器402被配置为将针对至少以下操作618的请求转换为跟踪本机代码指令的对应执行:向后执行步进进入914操作、向后执行步进退出918操作、以及向后执行步进跳过916操作。In some embodiments, the execution controller 402 is configured to translate a request for at least the following operations 618 into corresponding execution of trace native code instructions: a backward step-in operation 914, a backward step-out operation 918, and a backward step-skip operation 916.

在一些实施例中,执行控制器402被配置为将针对至少以下操作618的请求转换为跟踪本机代码指令的对应执行:在跟踪中继续向前执行910直到断点范围830中的任何位置被到达,以及在跟踪中继续向后执行920直到断点范围内的位置被到达。In some embodiments, execution controller 402 is configured to translate a request for at least the following operations 618 into corresponding execution of trace native code instructions: continuing forward execution in the trace 910 until any position within the breakpoint range 830 is reached, and continuing backward execution in the trace 920 until a position within the breakpoint range is reached.

在一些实施例中,系统800被配置为步进进入源代码的一部分,源代码的一部分在重放执行期间尚未被编译为本机代码指令。In some embodiments, system 800 is configured to step into a portion of source code that has not yet been compiled into native code instructions during replay execution.

在一些实施例中,中间表示826包括以下至少一项:将在源代码中使用的至少两个标识符1104与数据类型1106相关联的符号表1102、从源代码的至少一部分导出的抽象语法树1108、或源代码212的至少一部分到中间语言1110的转换1112。In some embodiments, the intermediate representation 826 includes at least one of the following: a symbol table 1102 that associates at least two identifiers 1104 used in the source code with a data type 1106, an abstract syntax tree 1108 derived from at least a portion of the source code, or a conversion 1112 from at least a portion of the source code 212 to the intermediate language 1110.

在一些实施例中,跟踪418不包含运行时204的任何执行实例,并且跟踪418未被配置为调用跟踪以执行特定于运行时的任何代码。In some embodiments, tracing 418 does not contain any execution instance of runtime 204, and tracing 418 is not configured to call tracing to execute any runtime-specific code.

在一些实施例中,系统800包括具有运行时的可调用实例的程序124的实时调试对象202。在一些实施例中,跟踪418从实时过程被记录并且系统被配置为重放跟踪的执行。In some embodiments, system 800 includes a real-time debug object 202 of program 124 having a runtime callable instance. In some embodiments, trace 418 is recorded from a real-time process and the system is configured to replay the execution of the trace.

在一些实施例中,系统800被配置为略过跟踪418的一部分的重放执行,因为执行控制器402将重放执行从跟踪的第一执行时间点移动到跟踪的第二执行时间点,而系统没有执行本会通过从第一位置到第二位置的继续执行而被执行的跟踪本机代码指令或其他跟踪条目。In some embodiments, system 800 is configured to skip a portion of the replay execution of trace 418 because execution controller 402 moves the replay execution from a first execution point of the trace to a second execution point of the trace, and the system does not execute trace native code instructions or other trace entries that would otherwise be executed through continued execution from the first position to the second position.

本领域技术人员将理解,一些其他系统也在这里所呈现的教导的范围内。特别地,一些其他系统可以执行跨级别映射404、使用断点范围830、以及实现本文中提供的其他教导,同时背离本文中叙述的特定示例。使用这里教导的执行控制教导中的任何一个执行控制的系统或装置都在本公开内,无论它们是否在所提供的特定示例中。Those skilled in the art will understand that other systems are also within the scope of the teachings presented herein. In particular, some other systems may perform cross-level mapping 404, use breakpoint range 830, and implement other teachings provided herein, while departing from the specific examples described herein. Any system or apparatus using any of the execution control teachings herein is within this disclosure, whether or not it is in the specific example provided.

一些方法示例Some method examples

图13示出了执行控制方法1300,该执行控制方法1300是由执行控制器402、跨级别映射404或本文中讨论的其他项执行或辅助的方法的示例。该示例方法包括标识1302所跟踪的被管理程序为所跟踪的被管理程序。将程序标识为所跟踪的是简单的;如果程序正在被跟踪,或者之前已经被跟踪,则该程序是所跟踪的程序。在某种程度上更多地涉及将程序标识为被管理,因为当程序依赖于运行时204进行实时执行时其被管理并且运行时204可以在不同实现中提供不同的服务。在很多情况下,运行时204通过基于可达性分析或引用计数或其他机制的垃圾收集来提供堆存储器的自动管理。然而,在本申请中更令人感兴趣的是使用运行时204来执行中间语言代码1112。在一些运行时中,从源到本机指令的转换没有被模块化为源到中间语言阶段,随后是中间语言到本机代码阶段。例如,一些平台直接执行源代码(甲骨文美国公司的商标)。仅出于本申请的目的,“被管理”程序是依赖于运行时204来产生本机指令的程序。被管理程序还可以受制于或者不受制于由运行时进行的垃圾收集。Figure 13 illustrates an example of an execution control method 1300, which is an example of a method executed or assisted by an execution controller 402, a cross-level mapping 404, or other items discussed herein. This example method includes identifying a managed program tracked by 1302 as a tracked managed program. Identifying a program as tracked is simple; if a program is being tracked, or has been tracked previously, then it is a tracked program. To some extent, it involves identifying a program as managed because it is managed when it depends on runtime 204 for real-time execution, and runtime 204 may provide different services in different implementations. In many cases, runtime 204 provides automatic management of heap memory through garbage collection based on reachability analysis, reference counting, or other mechanisms. However, what is of greater interest in this application is the use of runtime 204 to execute intermediate language code 1112. In some runtimes, the translation from source to native instructions is not modularized into a source-to-intermediate language stage, followed by an intermediate language-to-native code stage. For example, some platforms execute source code directly (a trademark of Oracle Corporation, USA). For the purposes of this application only, a "managed" program is a program that relies on runtime 204 to generate native instructions. A managed program may also be subject to or not subject to garbage collection performed by the runtime.

所示的方法1300还包括接收1304对某个跟踪重放执行控制操作的请求。该请求可以是通过用户界面直接来自用户的请求806,或者是来自调试器的对跟踪执行控制器402、406或408的请求214。The method 1300 shown also includes receiving a request 1304 to perform a control operation on a trace playback. This request may be a request 806 directly from the user through the user interface, or a request 214 from the debugger to the trace execution controllers 402, 406, or 408.

所示的方法1300还包括从源代码到中间表示的映射1306和从中间表示到本机代码的映射1308。这可以如指示的在两个阶段中完成,或者在一些其他实施例中,可以在从源代码到本机指令的单个组合阶段中完成。然而,与编译本身不同,无论是在两个阶段中还是一个阶段中,映射1306、1308都不是为了生成用于执行的代码,而是使源代码位置与先前所生成和所执行的指令的跟踪中的位置相关联。The illustrated method 1300 also includes a mapping 1306 from source code to an intermediate representation and a mapping 1308 from the intermediate representation to native code. This can be done in two stages as indicated, or in some other embodiments, in a single combined stage from source code to native instructions. However, unlike compilation itself, whether in two stages or one stage, mappings 1306 and 1308 are not for generating code for execution, but rather for associating source code locations with locations in the trace of previously generated and executed instructions.

一些实现通过使用包含与源相对应的IL的哈希值、校验和或其他标识符的符号文件,来从源代码映射1306到中间表示。如果标识符对应,则调试器将加载符号文件。该符号文件还包含用于编译IL的每个源文件的标识符。在调试器将要加载源文件并且将IL代码映射到源之前,它将利用符号文件中所包含的标识符来验证源文件的标识符。Some implementations map 1306 from source code to an intermediate representation using a symbol file that contains hashes, checksums, or other identifiers of the IL corresponding to the source. If the identifiers match, the debugger loads the symbol file. This symbol file also contains identifiers for each source file used to compile the IL. Before the debugger loads the source files and maps the IL code to the source, it verifies the source file identifiers using the identifiers contained in the symbol file.

当IL被即时编译(JIT)时,一些实现使用由运行时生成的映射从IL映射1308到本机代码。在一些实现中,运行时可能不能保证保留关于JIT将如何发生的向后兼容性,因此可以随时自由地对JIT过程进行改变。在这样的实现中,调试器可能不能对由JIT过程输出的本机代码将包含什么进行假定。因此,调试器可以要求运行时提供本机代码与IL之间的映射。When IL is compiled just-in-time (JIT), some implementations use a runtime-generated mapping to map 1308 from IL to native code. In some implementations, the runtime may not guarantee backward compatibility regarding how JIT will occur, and therefore is free to change the JIT process at any time. In such implementations, debuggers may not be able to make assumptions about what the native code output by the JIT process will contain. Therefore, debuggers may request the runtime to provide the mapping between native code and IL.

所示的方法1300的一些变型包括将本机指令组与源代码语句或表达式对准1318,这些本机指令是通过编译从这些源代码语句或表达式被生成的。Some variations of the method 1300 shown include aligning native instruction sets with source code statements or expressions 1318, which are generated by compiling from these source code statements or expressions.

所示的方法1300包括控制1310重放,也就是完成“执行控制”。控制1310的一个示例正在执行1312与步进、步进进入、步进跳过、步进退出或继续操作相对应的本机指令或其他跟踪条目,从而更改过程802状态。控制1310的另一示例是设置1314个体断点或断点范围。本领域技术人员将认识到,执行步进、步进进入、步进跳过、或者步进退出操作涉及设置断点,但是也能够在不执行本机指令或其他跟踪条目的情况下设置断点,例如,为继续操作做准备时。在一些实施例中,代码本身未被修改为在跟踪中设置断点。技术人员会认识到,处理器可以经由指令(例如,一些Intel架构中的int3)或经由硬件断点(说了要监测哪个地址的寄存器)来设置执行断点。在一些实施例中,跟踪重放执行控制系统800提供类似的能力。一些实现不修改代码流,并且支持任意大数目的断点。The illustrated method 1300 includes control 1310 for replay, which is to perform "execution control". An example of control 1310 is executing 1312 native instructions or other trace entries corresponding to step, step in, step skip, step out, or continue operation, thereby changing the state of process 802. Another example of control 1310 is setting 1314 individual breakpoints or breakpoint ranges. Those skilled in the art will recognize that performing step, step in, step skip, or step out operations involves setting breakpoints, but it is also possible to set breakpoints without executing native instructions or other trace entries, for example, when preparing for continue operation. In some embodiments, the code itself is not modified to set breakpoints in the trace. Those skilled in the art will recognize that the processor can set execution breakpoints via instructions (e.g., int3 in some Intel architectures) or via hardware breakpoints (registers that specify which address to monitor). In some embodiments, the trace replay execution control system 800 provides similar capabilities. Some implementations do not modify the code flow and support an arbitrarily large number of breakpoints.

最后,所示的方法1300包括发送1316对请求的响应,诸如响应416或者包含指令指针704或状态码706的另一消息或数据结构。Finally, the method 1300 shown includes sending 1316 a response to the request, such as response 416 or another message or data structure containing instruction pointer 704 or status code 706.

图14示出了在一些实施例中可以执行的一些附加的执行控制步骤。一些熟悉的调试器不支持向后步进退出操作918。然而,一些实施例标识1402对向后步进退出操作918的请求,并且如本文中教导的那样实现该操作。Figure 14 illustrates some additional execution control steps that may be performed in some embodiments. Some familiar debuggers do not support the backward step-out operation 918. However, some embodiments identify 1402 as a request for the backward step-out operation 918 and implement the operation as taught herein.

调试器可以实现一些通常熟悉的断点操作,即,用于设置1314断点的操作。然而,一些实施例在所指明的位置之前紧接设置1314、1404断点。一些实施例在指令组边缘824处设置1314、1406断点。一些实施例在例如被指定用于接收被即时编译的代码(由JIT编译器生成的代码)的地址范围上设置1314、1408断点范围830。特别地,一些实施例设置1434、1314、1408大断点范围1436、830。一些实施例设置1314、1410断点作为实现步进跳过操作的一部分,以步进跳过开发者可能不太感兴趣的运行时例程。例如,这样的运行时例程可以执行垃圾收集、JIT编译、反恶意软件或其他安全检查、或者运行时204管家功能。图14所示的其他步骤在本文中其他地方讨论,或者为了完整性而被包括在内,例如,不仅可以设置断点,还可以清除1442断点。Debuggers can implement some familiar breakpoint operations, namely, the operation for setting a breakpoint 1314. However, some embodiments set breakpoints 1314 and 1404 immediately before the specified location. Some embodiments set breakpoints 1314 and 1406 at the edge of the instruction group 824. Some embodiments set breakpoint range 830 of 1314 and 1408 on, for example, an address range designated for receiving code that is compiled just-in-time (JIT-compiled). In particular, some embodiments set large breakpoint ranges 1436 and 830 of 1434, 1314, and 1408. Some embodiments set breakpoints 1314 and 1410 as part of implementing a step-skip operation to step over runtime routines that the developer may not be interested in. For example, such runtime routines may perform garbage collection, JIT compilation, anti-malware or other security checks, or runtime 204 stewardship functions. The other steps shown in Figure 14 are discussed elsewhere in this document or included for completeness; for example, not only can breakpoints be set, but breakpoint 1442 can also be cleared.

除非另外指出,否则附图中示出或以其他方式公开的技术方法将由例如系统800自动地执行。在牵涉到人类管理员或其他人类的动作的范围内,方法也可以部分自动地和部分手动地执行,例如,人可以选择1426源代码语句或表达式,然后使用工具122用户界面来请求步进操作或断点操作。然而,这里没有考虑作为创新的方法是完全手动的。在一个给定实施例中,方法的零个或更多个示例步骤可以被重复,可能具有不同的参数或要操作的数据。一个实施例中的步骤也可以以与图中所示不同的顺序进行。步骤可以顺序地、以部分重叠的方式或完全并行地执行。在给定方法期间执行步骤的顺序可以从一种方法的执行到另一种方法的执行而变化。如果所执行的方法是可操作的并且符合至少一项权利要求,则步骤也可以被省略、组合、重命名、重新分组、或以其他方式偏离所示出的流程。Unless otherwise indicated, the technical methods shown in the figures or otherwise disclosed will be executed automatically by, for example, system 800. Within the scope of actions involving human administrators or other humans, the methods may also be executed partially automatically and partially manually; for example, a person may select 1426 source code statements or expressions and then use tool 122 user interface to request step operations or breakpoint operations. However, a completely manual method is not considered here as an innovation. In a given embodiment, zero or more example steps of the method may be repeated, possibly with different parameters or data to be manipulated. The steps in one embodiment may also be performed in a different order than those shown in the figures. Steps may be performed sequentially, in a partially overlapping manner, or in complete parallel. The order in which steps are performed during a given method can vary from execution of one method to execution of another. Steps may also be omitted, combined, renamed, regrouped, or otherwise deviated from the illustrated flow if the method being performed is operable and conforms to at least one claim.

一些实施例使用或提供用于跟踪重放执行控制方法的计算机实现的方法。一个示例方法包括标识1302所跟踪的被管理程序,即被配置为结合对运行时的调用来执行、并且被配置为要被跟踪的程序。该示例还包括在计算系统上运行的软件工具中接收1304跟踪重放执行控制请求。基于跟踪重放执行控制请求,该示例方法在所跟踪的被管理程序的源代码与源代码的中间表示之间自动地进行映射1306,并且在中间表示与跟踪418之间自动地进行映射1308。跟踪包括当所跟踪的被管理程序被执行时被跟踪的本机代码指令的记录。跟踪418不包括运行时的任何执行实例。该示例方法还执行1312与跟踪重放执行控制请求相对应的跟踪本机代码指令,从而重放跟踪的一部分。Some embodiments use or provide a computer-implemented method for a trace replay execution control method. One example method includes identifying, at 1302, the managed program being traced, i.e., a program configured to execute in conjunction with runtime calls and configured to be traced. The example also includes receiving, at 1304, a trace replay execution control request in a software tool running on a computing system. Based on the trace replay execution control request, the example method automatically maps, at 1306, the source code of the traced managed program to an intermediate representation of the source code, and at 1308, the intermediate representation to a trace, at 418. The trace includes a record of native code instructions traced when the traced managed program is executed. Trace 418 does not include any execution instances at runtime. The example method also executes, at 1312, the traced native code instructions corresponding to the trace replay execution control request, thereby replaying a portion of the trace.

在一些实施例中,跟踪重放执行控制请求标识1402向后执行步进退出操作,以步进退出例程,并且该方法包括在跟踪本机代码指令上设置1314、1404断点,该断点具有紧接在对例程的调用的返回地址的位置之前的位置。出于该方法的目的,当在跟踪的向前执行期间在B之前遇到1412A并且A与B之间存在至多五个跟踪本机代码指令时,在跟踪中位置A“紧接”在位置B“之前”。出于该方法的目的,当执行源级别的调试时,对准1318可以将指令组边缘824与在调用当前函数之前所执行的最近执行的源文件行号、语句或表达式相关联。一些实施例在例程的调用位置处设置断点,例如,一些实施例在当前函数的调用位置处设置断点。In some embodiments, the trace replay execution control request identifier 1402 performs a step-out operation backward to step out of the routine, and the method includes setting breakpoints 1314 and 1404 on the trace native code instructions, the breakpoints having a position immediately preceding the location of the return address of the call to the routine. For the purposes of this method, when 1412A is encountered before B during forward execution of the trace and there are at most five trace native code instructions between A and B, position A in the trace is "immediately preceding" position B. For the purposes of this method, when performing source-level debugging, alignment 1318 can associate instruction group edge 824 with the most recently executed source file line number, statement, or expression executed before the current function call. Some embodiments set breakpoints at the call location of the routine; for example, some embodiments set breakpoints at the call location of the current function.

通常,源代码包含语句218和表达式220。在一些实施例中,该方法包括在跟踪本机代码指令116上设置1406、1314断点,该断点在包括全部跟踪本机代码指令的组822边缘824上,全部跟踪本机代码指令由该方法映射到源代码中的给定语句或给定表达式。在一些实现中,该组仅包含全部跟踪本机代码指令,并且还可以包含其他指令。Typically, the source code contains statement 218 and expression 220. In some embodiments, the method includes setting breakpoints 1406 and 1314 on trace native code instruction 116, which are located at edge 824 of a group 822 containing all trace native code instructions mapped by the method to a given statement or expression in the source code. In some implementations, the group contains only all trace native code instructions, and may also contain other instructions.

在一些实施例中,所接收的跟踪重放执行控制请求806、214、414根据以下之一来命名、标识或以其他方式调用重放性能:向前执行步进跳过906操作,以向前步进跳过例程;向后执行步进跳过916操作,以向后步进跳过例程;向前执行步进进入904操作,以向前步进进入例程;或者向后执行步进进入914操作,以向后步进进入例程。In some embodiments, the received trace replay execution control requests 806, 214, 414 are named, identified, or otherwise invoked according to one of the following: performing a forward step skip 906 operation to step forward skip a routine; performing a backward step skip 916 operation to step backward skip a routine; performing a forward step enter 904 operation to step forward enter a routine; or performing a backward step enter 914 operation to step backward enter a routine.

在一些情况下,所接收的跟踪重放执行控制请求806、214、414根据向前执行步进进入904操作来命名、标识或以其他方式调用重放性能,以步进进入用户代码例程,并且用户代码例程的重放执行包括对运行时204例程的至少一个调用818的重放执行,并且对运行时例程的调用在源代码中没有对应的调用语句或调用表达式。在该上下文中,一些实施例包括以下至少一项:设置1408指明被指定为接收动态编译代码的整个存储器范围的断点范围,或者设置1410断点,以对运行时例程的调用执行步进跳过操作。In some cases, the received trace replay execution control requests 806, 214, 414 name, identify, or otherwise invoke replay functionality according to the forward execution step-in 904 operation to step into a user code routine, and the replay execution of the user code routine includes the replay execution of at least one call 818 to a runtime routine 204, and the call to the runtime routine has no corresponding call statement or call expression in the source code. In this context, some embodiments include at least one of the following: setting 1408 to specify a breakpoint range designated as receiving the entire memory extent of the dynamically compiled code, or setting a breakpoint 1410 to perform a step-skip operation on the call to the runtime routine.

在一些实施例中,向前步进进入步骤904操作如下进行。根据本文中的教导配置的调试器200将源行范围映射1306到中间语言范围,并且将中间语言范围映射1308到本机范围。然后,调试器使用低级别原语执行该步骤;这可以使用指令级别单步步进或断点来完成。当遇到调用818指令时,调试器确定目标是在源级别表示步进进入的高级别源步骤,还是不应当步进进入的运行时实现的明细,因为在源代码中未明确表示。例如,这个确定可以通过查询运行时或通过在源代码中搜索调用例程的名称来完成。如果调用是针对不同的高级别(在源代码中示出)例程,则调试器查询运行时204(例如,经由DAC 208)以确定调用例程是否已经被JIT编译。如果调用例程已经被JIT编译,则调试器使用指令级别单步步进进入调用或通过在目标例程内部设置断点来对调用执行步进进入904。如果尚未对调用例程进行JIT编译,则调试器将使用DAC 208或另一机制在JIT编译器上或在使用(多个)数据断点的JIT编译写入的目标地址区域上设置断点。调试器允许运行跟踪重放,直到JIT编译完成。调试器在JIT编译目标上设置断点并且运行。这样继续直到本机指令不再落入上述从初始动作映射的本机步进范围内,或者程序退出。例外是一种应当落在捕获(catch)的目标上的特殊情况。In some embodiments, the forward stepping into step 904 is performed as follows. The debugger 200, configured according to the teachings herein, maps the source line range 1306 to the intermediate language range and the intermediate language range 1308 to the native range. The debugger then performs this step using low-level primitives; this can be done using instruction-level single-stepping or breakpoints. When the call instruction 818 is encountered, the debugger determines whether the target is a high-level source step that indicates a stepping into at the source level, or a runtime implementation detail that should not be stepped into because it is not explicitly stated in the source code. For example, this determination can be done by querying the runtime or by searching for the name of the calling routine in the source code. If the call is for a different high-level (shown in the source code) routine, the debugger queries runtime 204 (e.g., via DAC 208) to determine whether the calling routine has been JIT-compiled. If the calling routine has been JIT-compiled, the debugger performs stepping into the call using instruction-level single-stepping or by setting a breakpoint inside the target routine to perform stepping into step 904. If the calling routine has not yet been JIT-compiled, the debugger will set breakpoints on the JIT compiler or on the target address region written by the JIT compiler using DAC 208 or another mechanism, with the JIT compilation using multiple data breakpoints. The debugger allows running a trace replay until the JIT compilation is complete. The debugger sets breakpoints on the JIT-compiled target and runs. This continues until native instructions no longer fall within the native step range mapped from the initial action, or the program exits. An exception is a special case that should fall on a catch target.

在一些实施例中,跟踪重放执行控制请求调用以下操作至少之一:在跟踪中向前910继续跟踪重放执行,直到到达断点828;在跟踪中向前910继续跟踪重放执行,直到到达断点范围830中的位置;在跟踪中向后920继续跟踪重放执行,直到到达断点828;或在跟踪中向后920继续跟踪重放执行,直到到达断点范围830中的位置。一些实施例还包括可能在请求中被调用的其他操作,包括例如以下中的一个或多个:向后执行步进进入914操作;向后执行步进退出918操作;向后执行步进跳过916操作;向前执行步进进入904操作;向前执行步进退出908操作;向前执行步进跳过906操作。更一般地,一个给定实施例可以限于本文中教导的操作的任何子集。In some embodiments, the trace replay execution control request invokes at least one of the following operations: continue tracing replay execution forward 910 in the trace until breakpoint 828 is reached; continue tracing replay execution forward 910 in the trace until a position in breakpoint range 830 is reached; continue tracing replay execution backward 920 in the trace until breakpoint 828 is reached; or continue tracing replay execution backward 920 in the trace until a position in breakpoint range 830 is reached. Some embodiments also include other operations that may be invoked in the request, including one or more of, for example, performing a step-in backward 914 operation; performing a step-out backward 918 operation; performing a step-skip backward 916 operation; performing a step-in forward 904 operation; performing a step-out forward 908 operation; and performing a step-skip forward 906 operation. More generally, a given embodiment may be limited to any subset of the operations taught herein.

在一些情况下,在执行所跟踪的被管理程序以创建跟踪418的期间,断点的最大数目受到处理器能够一次监测至多N个地址这一硬件断点约束的约束。然而,在一些实施例中,该方法在跟踪的重放执行期间设置1314多于N个断点,从而超出1414硬件断点约束。In some cases, during the execution of the managed program being traced to create trace 418, the maximum number of breakpoints is constrained by the hardware breakpoint constraint that the processor can monitor up to N addresses at a time. However, in some embodiments, the method sets more than N breakpoints during the replay execution of the trace, thus exceeding the hardware breakpoint constraint.

本领域技术人员将理解,其他方法也在这里所呈现的教导的范围内。特别地,其他系统可以执行跨级别映射404、使用断点范围830、以及实现本文中提供的其他教导,同时背离本文中叙述的特定示例。使用这里教导的任何执行控制教导的方法都在本公开内,而无论它们是否在所提供的特定示例中。Those skilled in the art will understand that other methods are also within the scope of the teachings presented herein. In particular, other systems may perform cross-level mapping 404, use breakpoint range 830, and implement other teachings provided herein, while departing from the specific examples described herein. Any method of implementing control teachings using the teachings herein is within this disclosure, regardless of whether it is within the specific examples provided.

一些配置的介质示例Examples of media configurations

一些实施例包括所配置的计算机可读存储介质112。介质112可以包括磁盘(磁性的、光学的或以其他方式)、RAM、EEPROMS或其他ROM和/或其他可配置的存储器,尤其包括计算机可读介质(其不仅仅是传播信号或能量)。被配置的存储介质尤其可以是可移动存储介质114,诸如CD、DVD或闪存。通用存储器(可以是可移动的或不可移动的,并且可以是易失性的或非易失性的)可以被配置为如下实施例:以从可移动介质114和/或诸如网络连接的另一源读取的数据118和指令116的形式使用诸如执行控制器402、重放适配器408、指令组822、跨级别映射404、机器级别请求414和响应416以及断点范围830的项,以形成所配置的介质。如本文中公开的,所配置的介质112能够引起计算机系统执行技术性处理步骤以供进行水平交叉(工具122中的高级别到跟踪418中的低级别)重放执行控制。因此,附图帮助说明所配置的存储介质实施例和过程实施例、以及系统和过程实施例。特别地,图4、13或14或本文中另外教导的任何处理步骤可以用于帮助将存储介质配置为形成所配置的介质实施例。Some embodiments include a configured computer-readable storage medium 112. Medium 112 may include a disk (magnetic, optical, or otherwise), RAM, EEPROMs or other ROMs, and/or other configurable memories, particularly computer-readable media (which are not merely for transmitting signals or energy). The configured storage medium may in particular be a removable storage medium 114, such as a CD, DVD, or flash memory. General-purpose memory (which may be removable or non-removable, and may be volatile or non-volatile) may be configured in embodiments to form the configured medium using items such as an execution controller 402, a playback adapter 408, an instruction set 822, a cross-level mapping 404, machine-level requests 414 and responses 416, and a breakpoint range 830, in the form of data 118 and instructions 116 read from the removable medium 114 and/or another source such as a network connection. As disclosed herein, the configured medium 112 is capable of causing a computer system to perform technical processing steps for horizontal cross-level (high-level in tool 122 to low-level in trace 418) playback execution control. Therefore, the accompanying drawings help illustrate the configured storage medium embodiments and process embodiments, as well as system and process embodiments. In particular, Figures 4, 13, or 14, or any other processing steps taught herein, can be used to help configure the storage medium to form the configured medium embodiment.

一些实施例使用或提供配置有代码的计算机可读存储介质112、114,该代码在由计算机处理器110执行时执行跟踪重放执行控制方法。在该示例中,跟踪重放执行控制方法包括接收1304在计算系统上运行的软件工具中的跟踪重放执行控制请求。该方法包括基于跟踪重放执行控制请求,在所跟踪的被管理程序的源代码与源代码的中间表示之间进行映射1306,并且在中间表示与跟踪418之间进行映射1308。跟踪418包括处理器活动的记录,处理器活动诸如当所跟踪的被管理程序被执行时被跟踪的本机代码指令,因为跟踪不包括运行时的任何执行实例。在该示例中,跟踪重放执行控制方法还包括执行1312与跟踪重放执行控制请求相对应的跟踪本机代码指令或其他跟踪条目,或者在跟踪本机代码指令上设置1314断点,从而控制1310跟踪的重放。Some embodiments use or provide computer-readable storage media 112, 114 configured with code that, when executed by computer processor 110, performs a trace replay execution control method. In this example, the trace replay execution control method includes receiving a trace replay execution control request 1304 from a software tool running on a computing system. The method includes mapping 1306 between the source code of the traced managed program and an intermediate representation of the source code, and mapping 1308 between the intermediate representation and a trace 418, based on the trace replay execution control request. The trace 418 includes a record of processor activity, such as native code instructions traced when the traced managed program is executed, since the trace does not include any execution instances at runtime. In this example, the trace replay execution control method also includes executing 1312 trace native code instructions or other trace entries corresponding to the trace replay execution control request, or setting a breakpoint 1314 on the trace native code instructions to control the replay of traces traced by 1310.

一些实施例与调试器200相组合操作,并且在这些情况中的一些情况下,所跟踪的被管理程序包括实时过程和执行运行时204。在没有1416终止1418所跟踪的被管理程序的情况下,调试器200与所跟踪的被管理程序的执行运行时204通信,并且该方法使用跟踪418控制1310向后执行重放。也就是说,在该示例中,反向调试与实时过程调试交织。Some embodiments operate in combination with debugger 200, and in some of these cases, the traced managed program includes a real-time process and an execution runtime 204. Without terminating the traced managed program at 1416, debugger 200 communicates with the execution runtime 204 of the traced managed program, and the method uses trace 418 to control 1310 to perform a backward replay. That is, in this example, reverse debugging is intertwined with real-time process debugging.

一些实施例执行特别感兴趣的以下活动中的一个或两个或三个或全部四个。一个特别有趣的活动是使用跟踪418中的机器级别信息在高级别控制1420运行时204的执行。在该上下文中,“在高级别”控制是指基于用户选择1426来控制(通过用户界面从用户104获取1424),该用户选择1426指明源代码中的标识符或语句或表达式。在该上下文中,“机器级别”信息是指特定于处理器架构的信息,例如特定指令集合或特定微架构。Some embodiments perform one, two, three, or all four of the following activities of particular interest. One particularly interesting activity is the execution of 204 at high-level control 1420 using machine-level information from trace 418. In this context, "high-level" control refers to control based on user selection 1426 (obtained from user 104 via a user interface) that specifies an identifier or statement or expression in the source code. In this context, "machine-level" information refers to processor architecture-specific information, such as a particular instruction set or a particular microarchitecture.

另一特别有趣的活动是调试200所跟踪的被管理程序的实时调试对象202、802的向前执行和向后执行两者。Another particularly interesting activity is the forward and backward execution of both the real-time debug objects 202 and 802 of the managed program being debugged by debug 200.

另一特别有趣的活动是至少部分通过设置1434大断点范围1436来步进进入源代码中所示的调用。在这种情况下,当断点范围涵盖跟踪418中的至少一千个连续地址或指令时,断点范围是“大”的。Another particularly interesting activity is stepping into the call shown in the source code, at least in part, by setting a large breakpoint range of 1434 to 1436. In this case, the breakpoint range is "large" when it covers at least one thousand consecutive addresses or instructions in tracing 418.

另一特别有趣的活动是在调试200所跟踪的被管理程序的实时调试对象202的同时,跟踪418来自实时过程的跟踪数据,并且然后使用所记录的跟踪数据中的至少一些跟踪数据对实时过程执行反向执行调试。Another particularly interesting activity is to simultaneously debug the real-time debug object 202 of the managed program being debugged (200), trace 418 trace data from the real-time process, and then use at least some of the trace data recorded to perform reverse execution debugging on the real-time process.

本领域技术人员将理解,其他配置的介质实施例也在本发明的教导范围内。特别地,一些其他实施例可以包括配置有用于在执行时执行跨级别映射404、使用断点范围830以及实现本文中提供的其他教导的代码的法定介质,同时背离本文中叙述的特定示例。被配置为使用这里教导的任何执行控制教导来执行方法的介质都在本公开内,而不管它们是否在所提供的特定示例中。Those skilled in the art will understand that other configurations of media embodiments are also within the scope of the teachings of this invention. In particular, some other embodiments may include statutory media configured with code for performing cross-level mapping 404 at execution time, using breakpoint range 830, and implementing other teachings provided herein, while departing from the specific examples described herein. Media configured to perform methods using any execution control teachings taught herein are within the scope of this disclosure, regardless of whether they are in the specific examples provided.

具有JIT代码的示例Example with JIT code

假定源代码包括类似于如下所示的C#中的类的类:Assume the source code includes classes similar to those in C#, as shown below:

如果将语言用作C++,则开发者将合理地期望Squid.Swim()中对WiggleLeg()的调用可以编译为以下形式(类似于汇编代码):If the language is C++, the developer would reasonably expect that the call to WiggleLeg() in Squid.Swim() can be compiled into the following form (similar to assembly code):

CALL 0x0c84fabd;0x0c84fabd是Squid::WiggleLeg()的地址CALL 0x0c84fabd; 0x0c84fabd is the address of Squid::WiggleLeg().

在这种情况下,0x0c84fabd将开始Squid::WiggleLeg()的实现。但是在运行时204中执行的被管理软件中,不是这样的。运行时204运行的代码被“及时”编译,又称“jit”。如果这是第一次调用Squid::WiggleLeg(),则将没有针对Squid::WiggleLeg()的机器指令116。它尚未被编译。因此,与其让机器指令实现Squid::WiiggleLeg(),不如让0x0c84fabd具有一些看起来像这样的指令(以伪代码形式):In this scenario, 0x0c84fabd would begin implementing Squid::WiggleLeg(). However, this is not the case in managed software executed in runtime 204. Code executed in runtime 204 is compiled "just-in-time," also known as "jit." If this is the first call to Squid::WiggleLeg(), there will be no machine instruction 116 for Squid::WiggleLeg(). It has not yet been compiled. Therefore, instead of having the machine instruction implement Squid::WiggleLeg(), 0x0c84fabd would have some instructions that look something like this (in pseudocode):

这一点代码称为“预桩”。编译过程是漫长且复杂的,因此通常,试图通过跟踪应用并且使用跟踪来分析或调试应用的开发者不想详细记录编译过程。然而,跟踪418可能会记录该桩的至少一部分,即使这些所跟踪的指令都可能不会引起调试代码的人员的兴趣。在实时过程调试中,运行时通常会略过代码的这部分。然而,当仅从跟踪418进行调试时,调试对象的运行时204不会执行,因此不能略过预桩。相反,一个实施例可以利用通常用于读取转储文件302中的数据的过程外调试实用(out-of-process debugging utility)的功能性、以及可以一起用于在运行时中找到全部JITTED代码的地址范围的创新的跟踪重放功能性。在接收到步进进入方法调用的请求之后,一个实施例可以在JITTED代码范围上暂时设置1314断点,并且虚拟地向前执行(即,向前重放),直到第一JITTED代码范围被读取。一旦被读取,实施例就可以去除断点。这样,开发者可以略过所有这些不感兴趣的“桩”代码。一些实施例还通过将断点的地址范围瞄准(target)为仅是Squid::WiggleLeg_implementation的范围来优化该方法。This point in the code is called a "stub". The compilation process is lengthy and complex, so developers who typically try to analyze or debug their applications by tracing them often don't want to document the compilation process in detail. However, trace 418 may record at least a portion of the stub, even if the traced instructions are unlikely to be of interest to those debugging the code. In real-time process debugging, the runtime typically skips this part of the code. However, when debugging only from trace 418, the runtime 204 of the debugged object is not executed, so the stub cannot be skipped. Instead, one embodiment can leverage the functionality of an out-of-process debugging utility typically used to read data from dump file 302, and an innovative trace replay functionality that can be used together to find the address range of all JITTED code at runtime. Upon receiving a request to step into a method call, one embodiment can temporarily set a breakpoint 1314 on the JITTED code range and virtually execute forward (i.e., replay forward) until the first JITTED code range is read. Once read, the embodiment can remove the breakpoint. In this way, developers can skip all these uninteresting "stubs" of code. Some implementations further optimize the method by targeting the address range of the breakpoints to be limited to the range of `Squid::WiggleLeg_implementation`.

一些附加的组合和变型Some additional combinations and variations

代码、数据结构、逻辑、组件、通信和/或其功能等价物的这些组合中的任何组合也可以与上述任何系统及其变型组合。过程可以以可操作的任何子集或组合或序列包括本文中描述的任何步骤。每个变型可以单独出现,或者与其他任何一个或多个其他变型组合出现。每个变型可以与任何过程一起出现,并且每个过程可以与任何一个或多个其他过程组合。每个过程或过程组合(包括变型)可以与上述介质组合和变型中的任何一个组合。Any combination of these combinations of code, data structures, logic, components, communications, and/or their functional equivalents may also be combined with any of the systems and their variants described above. A process may include any step described herein in any operable subset or combination or sequence. Each variant may appear alone or in combination with any one or more other variants. Each variant may appear with any process, and each process may be combined with any one or more other processes. Each process or combination of processes (including variants) may be combined with any of the media combinations and variants described above.

在一些实施例中,跟踪重放组件使用源-IL映射和IL-机器映射在跟踪文件420位置(例如,由时间码424所指明)和源代码212中的位置(例如,指明为行号)之间转换。In some embodiments, the trace replay component uses source-IL mapping and IL-machine mapping to convert between the location in trace file 420 (e.g., indicated by timecode 424) and the location in source code 212 (e.g., indicated by line number).

在一些实施例中,在跟踪重放组件406中提供了运行时功能性的一部分。但是,运行时不是像在图2的实时过程中那样在调试器、用户代码和操作系统之间中介,而是该运行时功能性在调试器与(多个)跟踪文件420之间进中介。In some embodiments, a portion of runtime functionality is provided in the trace replay component 406. However, instead of mediating between the debugger, user code, and operating system as in the real-time process of Figure 2, the runtime functionality mediates between the debugger and trace(s)420.

一些跟踪记录过程仅记录两种数据。所记录的一种数据是代码指令116的执行,这些代码指令有可能在多个线程上并行执行。所记录的另一种数据是在执行时间的离散点处拍摄的存储器的特定块的快照304,例如以捕获堆栈的一部分。然而,其他跟踪过程会记录不同或附加类型的数据,如图4所示。在一些情况下,跟踪包含所有记录指令及其所有输入和输出的有效表示。通过依赖于(多个)处理器110的确定性并且主要记录基于该确定性不能推断的信息以及已经记录在跟踪418中的信息,可以使跟踪418的记录高效地进行。在一些实现中,大部分跟踪418是数据,而不是所执行的代码指令;这样的数据通常是不确定的。跟踪可以主要是种子数据加上不确定信息。在一些情况下,仅将进入被跟踪的(多个)处理器的高速缓存的信息记录到跟踪418中,例如,将值V读入处理器高速缓存被输入到跟踪中,但是从处理器的寄存器向存储器位置X写入值V不一定被输入到跟踪中。如果对X的写操作在所跟踪的程序的行为方面有所不同,那是因为在某个时刻,写入值从X返回到处理器寄存器,此时,如果跟踪仍被启用,则在跟踪418中的条目可以被实现。Some trace recording processes record only two types of data. One type of data is the execution of code instructions 116, which may be executed in parallel on multiple threads. The other type of data is a snapshot 304 of a specific block of memory taken at discrete points in execution time, such as to capture a portion of the stack. However, other trace processes record different or additional types of data, as shown in Figure 4. In some cases, the trace contains a valid representation of all recorded instructions and all their inputs and outputs. The recording of trace 418 can be made efficient by relying on the determinism of processor(s) 110 and primarily recording information that cannot be inferred from that determinism, as well as information already recorded in trace 418. In some implementations, most of trace 418 is data, rather than the executed code instructions; such data is often indeterminate. The trace can be primarily seed data plus indeterminate information. In some cases, only information entering the cache of the traced processor(s) is recorded in trace 418; for example, reading the value V into the processor cache is input into the trace, but writing the value V from a processor register to memory location X is not necessarily input into the trace. If a write operation to X behaves differently in terms of the traced program, it is because at some point the written value is returned from X to the processor register, at which point, if tracing is still enabled, the entry in trace 418 can be executed.

在此使用示例、图示、定义和其他描述性材料描述了来自过程跟踪的高级别程序的执行控制。技术人员会认识到,可以使用各种技术在机器级别创建过程的跟踪,各种技术诸如在运行Microsoft环境的系统上进行跟踪的Windows事件跟踪(ETW)或“时间旅行跟踪”、在运行环境的系统上进行跟踪的(分别为Efficios公司和Linus Torvalds的商标)、针对类似环境进行跟踪的(分别为甲骨文美国公司和X/Open公司的商标)、以及其他跟踪技术。然后可以使用硬件的仿真模拟来重放跟踪。有时,该过程是用高级别语言编写的,该语言需要运行时框架才能实际执行该过程。其一个示例是在公共语言运行库(CLR)中运行的.NET应用。在跟踪中向前或向后移动这本身对高级别程序的开发者没有帮助,因为跟踪的视图是运行时或即时编译的代码的视图而不是高级别程序的视图。本文档介绍了一种将跟踪中的机器级别指令映射到程序中高级别操作的方法。这允许设置和达到断点以及高级别语言中的向前和反向步进。This document describes the execution control of a high-level program derived from a process tracing using examples, illustrations, definitions, and other descriptive materials. Technicians will recognize that process traces can be created at the machine level using various techniques, such as Windows Event Tracing (ETW) or "Time Travel Tracing" for systems running Microsoft environments, tracing for runtime environments (trademarks of Efficios, Inc. and Linus Torvalds, respectively), tracing for similar environments (trademarks of Oracle Corporation and X/Open, Inc., respectively), and other tracing techniques. The trace can then be replayed using hardware emulation. Sometimes, the process is written in a high-level language that requires a runtime framework to actually execute the process. One example is a .NET application running in the Common Language Runtime (CLR). Moving forward or backward in a trace is not helpful in itself to developers of high-level programs because the view of the trace is a view of the runtime or just-in-time compiled code, not a view of the high-level program. This document describes a method for mapping machine-level instructions in a trace to high-level operations in the program. This allows for setting and reaching breakpoints, as well as forward and backward stepping in high-level languages.

可以通过将复杂度抽象为三层来实现在高级别运行时中步进通过代码的过程。在最低层(第0层)是过程跟踪418。该跟踪包含足够的信息以允许在硬件级别仿真模拟所记录的过程执行。The process of stepping through the code at a high-level runtime can be achieved by abstracting the complexity into three layers. At the lowest level (level 0) is the process trace 418. This trace contains enough information to allow the recorded process execution to be simulated at the hardware level.

在第1层,适当配置的系统可以应用一些非常基本的硬件调试支持来重放跟踪。这种支持可以包括:能够向前或向后播放过程、读取过程存储器、读取线程上下文(每个线程的)、设置硬件断点以及每个线程的单步步进机器指令。At level 1, a properly configured system can apply some very basic hardware debugging support for replaying traces. This support may include: the ability to play the process forward or backward, read the process memory, read the thread context (for each thread), set hardware breakpoints, and single-step machine instructions for each thread.

在第2层,提供了用于将机器指令的范围映射到高级别虚拟机(VM)指令的范围或另一种代码的支持。第1层中的操作可以用于调试高级别代码。在一些配置中,要支持的操作是向前运行、向后运行、设置断点、步进进入、步进退出、以及步进跳过。在示例中,以下给出关于每个操作的实现的细节。At level 2, support is provided for mapping the range of machine instructions to the range of higher-level virtual machine (VM) instructions or another type of code. Operations in level 1 can be used to debug higher-level code. In some configurations, the operations to be supported are forward, backward, setting breakpoints, stepping in, stepping out, and stepping skipping. Details of the implementation for each operation are given below in the examples.

关于向前和向后运行,在该示例中,它们在高级别和机器级别运行时中是等效的,因此这完全在第1层中进行处理。Regarding forward and backward execution, in this example, they are equivalent in high-level and machine-level execution, so this is handled entirely at level 1.

关于断点,在该示例中,通过使用在层2中定义的映射来设置断点,以将高级别断点映射到硬件断点。当遇到硬件断点时,实现可以使用该映射将该硬件断点映射回高级别断点。Regarding breakpoints, in this example, breakpoints are set using a mapping defined in layer 2 to map higher-level breakpoints to hardware breakpoints. When a hardware breakpoint is encountered, the implementation can use this mapping to map that hardware breakpoint back to a higher-level breakpoint.

关于向前和反向步进退出,通过使用堆栈跟踪,实现可以在函数的返回地址处设置硬件断点。为了实现反向步进退出,断点被设置在返回地址之前的指令上。Regarding forward and reverse stepping exits, a hardware breakpoint can be set at the function's return address using stack tracing. To implement reverse stepping exit, the breakpoint is set on the instruction preceding the return address.

关于向前和反向步进跳过,可以通过查看要执行的下一指令来实现步进跳过。依赖于指令,实现可以使用第1层来或者执行单步步进或者设置断点并且运行直到其被达到。“调用”指令是需要断点的指令的示例。大多数其他指令可以使用单步步进。与一些熟悉的方法不同,该示例调试器实现可以使用第2层中的映射来重复步进操作,直到指令指针或代码执行时间点位于高级别运行时中的适当停止点处。这激发了本文中其他地方对指令组822的讨论。Regarding forward and backward step skipping, step skipping can be achieved by looking at the next instruction to be executed. Depending on the instruction, the implementation can use Level 1 to either perform single-stepping or set a breakpoint and run until it is reached. The "call" instruction is an example of an instruction that requires a breakpoint. Most other instructions can use single-stepping. Unlike some familiar approaches, this example debugger implementation can use mappings in Level 2 to repeat the stepping operation until the instruction pointer or code execution time point is at the appropriate stop point in the higher-level runtime. This inspires the discussion of instruction group 822 elsewhere in this paper.

关于反向步进进入,为了执行反向步进进入,该实现使用在层1中定义的单步步进操作。如果机器刚从调用指令返回,则该使用将把执行时间点返回到前一调用的返回指令。如果机器不是刚从调用返回,则机器将简单地退回到前一指令。与步进跳过一样,实现可以使用第2层中的映射来知道执行何时在停止点处,并且可能需要单步步进多几次才能执行跟踪与源代码的对准1318。Regarding reverse step-in, to perform reverse step-in, this implementation uses the single-step operation defined in Layer 1. If the machine has just returned from the calling instruction, this usage will return the execution time point to the return instruction of the previous call. If the machine has not just returned from the call, the machine will simply backtrack to the previous instruction. Similar to step-skip, the implementation can use the mapping in Layer 2 to know when execution is at a stop point, and may need to perform single-steps several times to align the trace with the source code 1318.

关于向前步进进入,在这种实现中,向前步进进入与反向步进进入相似。然而,如果高级别运行时需要执行与正在运行的高级别代码不直接相关的工作,则可能会出现困难。一些示例是实时编译、运行时内务处理、以及需要由运行时进行某种解决的步进操作(.NET中的透明代理是该解决挑战的一个示例)。可以实现以下中的任一个或全部以解决这些困难。一个选项是在开始步进进入时为所有经即时编译的代码设置很大的断点范围。如果在步进进入之后遇到该断点,则实现可以在到达下一停止点时完成该步骤。另一选项是在步进引擎中实现逻辑以充分理解运行时,从而知道何时要步进跳过调用以及何时要单步步进通过调用,使得实现可以在高级别运行时中的适当点处停止步进。Regarding forward stepping, in this implementation, forward stepping is similar to reverse stepping. However, difficulties can arise if the higher-level runtime needs to perform work that is not directly related to the running higher-level code. Some examples are just-in-time (JIT) compilation, runtime housekeeping, and stepping operations that require some form of runtime resolution (transparent proxies in .NET are an example of this challenge). These difficulties can be addressed by implementing any or all of the following: One option is to set a large breakpoint range for all JIT-compiled code at the start of stepping. If the breakpoint is encountered after stepping, the implementation can complete the step when the next stopping point is reached. Another option is to implement logic in the stepping engine that fully understands the runtime, knowing when to skip calls and when to single-step through calls, allowing the implementation to stop stepping at appropriate points in the higher-level runtime.

在一些实施例中,过程外执行控制通过使用例如由重放组件406提供的功能和IL到地址映射812来控制IL指令的执行。用于执行控制的重放组件406或其他执行控制器402、408提供的功能包括:In some embodiments, out-of-process execution control controls the execution of IL instructions by using, for example, the functionality provided by replay component 406 and IL-to-address mapping 812. The functionality provided by replay component 406 or other execution controllers 402, 408 for execution control includes:

获取所有线程的状态(寄存器值)Get the status (register values) of all threads.

向前或向后步进一条指令Step forward or backward by one instruction

向前或向后运行,直到指令指针到达所指明的地址集。Run forward or backward until the instruction pointer reaches the specified address set.

IL到地址映射存在于过程或跟踪的存储器图像中,并且重放层可以将其提供给过程外执行控制调试器。一种观点认为,该示例包括将IL级别的调试转换为机器级别的调试。The IL-to-address mapping exists in the memory image of the process or trace, and the replay layer can provide it to an off-process execution control debugger. One perspective suggests that this example involves converting IL-level debugging into machine-level debugging.

通过步进个体指令,或者在跟踪中向前和向后运行直到到达特定指令地址,一些实现支持使用源到IL映射810、IL到本机映射812、本机样式的过程外执行控制、以及在跟踪418中向前和反向行进的能力,来将高级别执行控制应用于跟踪。By stepping individual instructions, or by running forward and backward in the trace until a specific instruction address is reached, some implementations support the application of high-level execution control to the trace using source-to-IL mapping 810, IL-to-native mapping 812, native-style out-of-process execution control, and the ability to run forward and backward in the trace 418.

考虑鉴于实时过程调试的示例Consider examples of real-time process debugging.

作为基于跟踪的执行控制的进一步说明,考虑特定实施例可以类似于实时调试或不同于实时调试的一些方式。以下引用了几个组件,并且本领域技术人员将理解它们与本文中提供的其他示例的关系,并且特别地理解,为了理解或易于实现,可以将功能分组为不同的组件,而不必背离本文中提供的执行控制教导。本示例中讨论的系统800组件包括:As a further illustration of trace-based execution control, consider that certain embodiments may resemble or differ from real-time debugging. Several components are referenced below, and those skilled in the art will understand their relationship to other examples provided herein, and in particular, that functionality may be grouped into different components for ease of understanding or implementation without departing from the execution control teachings provided herein. The system 800 components discussed in this example include:

用户界面(UI)。用户界面,其以图形方式向用户显示调试器的程序状态的表示。程序状态的示例是线程的列表、要在每个线程上执行的下一行源代码、针对每个线程的调用栈、调用栈的每一帧中的变量的集合、这些变量的值等。 User Interface (UI). The user interface graphically displays a representation of the debugger's program state to the user. Examples of program state include a list of threads, the next line of source code to be executed on each thread, the call stack for each thread, the set of variables in each frame of the call stack, and the values of these variables.

源转换。源代码转换部分,其负责在运行时抽象与源代码级别抽象之间进行转换。例如,CLR运行时使用以二进制文件格式编码的IL指令来表示代码,而C#源代码具有文本语句的语法。作为一个示例,调试器的这一层可以在运行时的抽象层(例如,在ECMA-335标准中,通用语言架构(CLI)第6版(2012年6月)或其后续版本中定义的)与C#抽象层(例如,在C#语言规定版本5.0或其后续版本中定义)之间进行转换。 Source translation. This part of the code translation is responsible for translating between runtime abstractions and source code-level abstractions. For example, the CLR runtime uses IL instructions encoded in binary file format to represent code, while C# source code has the syntax of text statements. As an example, this layer of the debugger can translate between runtime abstraction layers (e.g., those defined in ECMA-335, Common Language Architecture (CLI) version 6 (June 2012) or later) and C# abstraction layers (e.g., those defined in C# language specification version 5.0 or later).

运行时转换。调试器的运行时转换部分负责在低级别概念(诸如存储器和寄存器)与运行时抽象之间进行转换。运行时抽象的示例包括线程的列表、针对每个线程的调用栈、以及接下来将要被执行的IL指令。注意,抽象的运行时层处的调用栈不必与抽象的源代码级别处的调用栈相同。仅在实时调试的情况下,为了协助完成一些任务,该层使用过程间通信机制来请求正在被调试的过程内的运行时执行工作。例如,为了在偏移为28的方法Foo中的IL指令处设置断点,该层将向运行时发送消息以要求其在偏移为28的Foo处设置断点。然后,运行时内的线程将接收该消息,将Foo IL偏移28转换为驻留于存储器地址0x4567123512395处的机器指令,然后在该位置写入断点指令。可以合理地将服务于那些请求的运行时的部分视为在功能上也位于调试器的这一层内,即使它是在不同的过程中实现的。 Runtime translation. The runtime translation section of the debugger is responsible for translating between low-level concepts (such as memory and registers) and runtime abstractions. Examples of runtime abstractions include a list of threads, a call stack for each thread, and the IL instructions to be executed next. Note that the call stack at the abstract runtime layer does not have to be the same as the call stack at the abstract source code level. Only in the case of real-time debugging, this layer uses inter-procedural communication mechanisms to request the runtime within the process being debugged to perform work in order to assist with certain tasks. For example, to set a breakpoint at an IL instruction in method Foo at offset 28, this layer sends a message to the runtime requesting it to set the breakpoint at offset 28 of Foo. The thread within the runtime then receives the message, translates the Foo IL offset 28 into machine instructions residing at memory address 0x4567123512395, and then writes the breakpoint instruction at that location. It is reasonable to consider the part of the runtime that serves those requests as functionally located within this layer of the debugger, even if it is implemented in a different process.

基础。调试器的低级别部分负责使用内核、或者转储文件、或者跟踪来产生将由运行时转换部分读取的存储器和寄存器。对于内核过程,这在一些环境中是通过API(诸如ReadProcessMemory)实现的。对于跟踪文件,它支持解析文件并且在时间t和当时所记录的一些存储器和寄存器内容的集合之间建立映射。 The basics. The low-level parts of the debugger are responsible for using the kernel, dump files, or traces to generate memory and registers that will be read by the runtime translation section. For kernel procedures, this is implemented in some environments via APIs such as ReadProcessMemory. For trace files, it supports parsing the file and establishing a mapping between time t and a set of memory and register contents recorded at that time.

考虑到这些组件,考虑设置断点并且向前执行程序直到到达断点的情况。一种观点认为,实时过程调试大致涉及以下动作。Considering these components, consider the scenario where a breakpoint is set and the program is executed forward until the breakpoint is reached. One perspective suggests that real-time process debugging generally involves the following actions.

动作1.用户界面。用户在显示的源代码行上单击鼠标,以指示应当在何处设置断点。Action 1. User Interface. The user clicks the mouse on the displayed source code line to indicate where a breakpoint should be set.

动作2.源转换。源代码行被转换为特定方法和IL指令偏移。Action 2. Source Transformation. Source code lines are transformed into specific method and IL instruction offsets.

动作3.运行时转换。将消息发送到运行时,然后在运行时内,方法+IL指令偏移被转换为存储器地址。然后,断点操作码被写入该处。Action 3. Runtime Translation. The message is sent to the runtime, where the method + IL instruction offset is translated into a memory address. Then, the breakpoint opcode is written to that address.

动作4.用户界面。用户单击UI中的按钮,指示他们希望过程运行。Action 4. User Interface. Users click buttons in the UI to indicate whether they want the process to run.

动作5.源转换。转发要运行的请求。Action 5. Source Transformation. Forward the request to be executed.

动作6.运行时转换。消息被发送到运行时204,请求其向前执行。在接收到消息时,运行时将向前执行,然后到达早前设置的特定存储器地址处的断点。断点的存储器地址被转换回方法和IL偏移,然后通知消息被发送回调试器,指示已经达到特定方法/IL偏移的断点。Action 6. Runtime Translation. A message is sent to runtime 204, requesting it to proceed forward. Upon receiving the message, the runtime proceeds forward and then reaches the breakpoint at the previously set specific memory address. The breakpoint's memory address is translated back to the method and IL offset, and a notification message is then sent back to the debugger, indicating that the breakpoint at the specific method/IL offset has been reached.

动作7.源转换。到达断点的消息从方法和IL偏移被转换回源行,并且继续向UI发送关于该源行处的断点被到达的通知。Action 7. Source Transformation. The message indicating that the breakpoint has been reached is transformed from the method and IL offset back to the source line, and notifications about the breakpoint being reached at that source line continue to be sent to the UI.

动作8.用户界面。UI请求有关过程的新状态的其他信息,使得它可以向用户显示当前状态信息,诸如针对每个线程的当前调用栈。Action 8. User Interface. The UI requests additional information about the new state of the process, allowing it to display current state information to the user, such as the current call stack for each thread.

动作9.源转换。为了提供调用栈的源抽象,该组件首先请求接收调用栈的运行时抽象。Action 9. Source Transformation. To provide a source abstraction of the call stack, this component first requests a runtime abstraction that receives the call stack.

动作10.运行时转换。为了提供调用栈的运行时抽象,该组件首先请求接收存储器和寄存器的状态。Action 10. Runtime Transition. To provide a runtime abstraction of the call stack, this component first requests to receive the state of memory and registers.

动作11.基础。确定当前时间处的存储器和寄存器。Action 11. Basics. Determine the memory and registers at the current time.

动作12.运行时转换。使用存储器和寄存器,计算调用栈的运行时抽象。Action 12. Runtime Transformation. Using memory and registers, compute the runtime abstraction of the call stack.

动作13.源转换。使用调用栈的运行时抽象,计算调用栈的源代码抽象。Action 13. Source Transformation. Calculate the source code abstraction of the call stack using the runtime abstraction of the call stack.

动作14.用户界面。使用调用栈的源代码抽象,UI现在可以向用户显示被调试的过程的当前状态。Action 14. User Interface. Using the source code abstraction of the call stack, the UI can now display the current state of the process being debugged to the user.

在一些实施例中,当使用跟踪动作3、6和11时,不再以相同的方式操作。对于动作3和6,没有过程可以接收消息以设置断点、以向前执行、或者以当断点被到达时发送回通知。对于动作11,没有过程可以使用内核API来查询以确定存储器或寄存器。In some embodiments, when using tracing actions 3, 6, and 11, the operation is no longer the same. For actions 3 and 6, no procedure can receive messages to set breakpoints, to advance execution, or to send back notifications when a breakpoint is reached. For action 11, no procedure can use the kernel API to query and determine memory or registers.

因此,在一些实施例中,为了实现上述动作3,源转换代码要求运行时转换代码指示哪个存储器地址X具有针对应当在该处设置断点的给定方法+IL偏移的机器代码。该地址X被保存以备后用。Therefore, in some embodiments, in order to achieve action 3 above, the source translation code requires the runtime translation code to indicate which memory address X has machine code for a given method + IL offset where a breakpoint should be set. This address X is saved for later use.

为了实现上述动作6,在一些实施例中,源转换代码直接指导调试器或(多个)其他工具的低级别基础部分将跟踪推进到新的时间t',t'是地址X处的机器指令将在该处被模拟或被仿真模拟以执行的下一时间点。对于动作6,一个实施例可以使用在转储调试中通常使用的相同过程来从IL偏移转换为过程存储器偏移。然而,该实施例使用经转换的存储器偏移来在跟踪重放引擎内部设置虚拟断点。当重放引擎在虚拟执行期间读取该存储器地址时,虚拟过程(重放执行)将停止。的确,如果跟踪包含相同功能的多于一个的版本(经由重新即时编译(re-jitted)),则运行时转换可能会要求跟踪提供多个地址来涵盖单个断点。对于跟踪中的不同时间范围,该地址可以是不同的地址,也可以是运行时函数(如jitting函数)的地址,以便运行时转换能够定位函数的新重新即时编译的位置。To achieve action 6 above, in some embodiments, the source translation code directly instructs the low-level base of the debugger or (multiple) other tools to advance the tracing to a new time t', where t' is the next time point where the machine instruction at address X will be simulated or emulated for execution. For action 6, one embodiment can use the same procedure typically used in dump debugging to translate from an IL offset to a procedure memory offset. However, this embodiment uses the translated memory offset to set a virtual breakpoint within the tracing replay engine. The virtual procedure (replay execution) stops when the replay engine reads this memory address during virtual execution. Indeed, if the tracing contains more than one version of the same functionality (via re-jitted), the runtime translation may require the tracing to provide multiple addresses to cover a single breakpoint. This address can be different for different time ranges in the tracing, or it can be the address of a runtime function (such as a jittering function) so that the runtime translation can locate the new re-jitted position of the function.

为了实现上述动作11,代替从实时过程中进行读取,跟踪418被读取,并且提供与时间t'相对应的存储器和寄存器。To achieve the above action 11, instead of reading from the real-time process, trace 418 is read and memory and registers corresponding to time t' are provided.

重放调试场景Replay debugging scene

通过在调试时提供对向前和向后执行的访问权,系统800可以增强调试效率。例如,一些实施例支持如下的调试场景。By providing access to both forward and backward execution during debugging, system 800 can enhance debugging efficiency. For example, some embodiments support the following debugging scenarios.

通过上下文的方式,技术人员将认识到生产调试是困难的。假定客户在网站上报告了问题。开发者如何调试它?一些熟悉的方法依赖于诸如日志和转储等信息,它们仅提供时间点信息。因此,如果问题没有在日志或转储中捕获的特定时刻重现或发生,则开发者必须再次尝试在执行的不同点捕获有用的信息,这表示要花费更长的时间来解决问题。By using context, technicians will realize that production debugging is difficult. Suppose a customer reports an issue on the website. How do developers debug it? Some familiar methods rely on information such as logs and dumps, which only provide point-in-time information. Therefore, if the problem doesn't reproduce or occur at the specific moment captured in the logs or dumps, developers must try again to capture useful information at different points in the execution, meaning it takes much longer to resolve the issue.

相反,想象一下,环境可以逐行确切地告诉开发者生产应用程序中发生了什么。使用Microsoft时间旅行调试或其他反向执行重放的实施例允许团队成员收集应用行为的高保真记录。然后,开发者可以在通常熟悉的环境(诸如Microsoft环境或其他调试或集成开发环境)中脱机调试应用。Instead, imagine an environment that can tell developers exactly what's happening in a production application, line by line. Using Microsoft Time Travel debugging or other reverse-execution replay implementations allows team members to collect a high-fidelity record of the application's behavior. Developers can then debug the application offline in a familiar environment, such as a Microsoft environment or other debugging or IDE.

作为一个具体示例,假定SmartHotels360网站出现问题;这是一个演示网站,其代码通过GitHub.com网站从Microsoft公司公开可获取。运行该SmartHotels360网站的公司的开发者从用户处获取一份报告,该报告显示BestHotels的功能不再显示数据。然而,它之前运行良好,并且该问题并未在公司的测试或登台环境中重现。操作团队或工程团队的成员在运行为故障功能提供动力的代码时,已经收集了该应用的记录(跟踪418)。可以通过命令行工具将跟踪418收集到文件420中,或者在满足某个条件时由云环境(或另一云环境)自动触发记录,某个条件诸如抛出超出预期的更多异常的方法。As a concrete example, suppose the SmartHotels360 website is experiencing an issue; this is a demo website whose code is publicly available from Microsoft via GitHub.com. The developers of the company running the SmartHotels360 website receive a report from users indicating that a feature in BestHotels is no longer displaying data. However, it was working perfectly before, and the issue has not been reproduced in the company's test or staging environments. Members of the operations or engineering team have collected logs (trace 418) of the application while running the code powering the malfunctioning feature. Trace 418 can be collected into file 420 via command-line tools, or automatically triggered by a cloud environment (or another cloud environment) when certain conditions are met, such as throwing more exceptions than expected.

开发者打开调试器并且加载SmartHotels360代码和跟踪文件420。在返回BestHotels的API中,执行在28行的断点处停止。现在,即使这是一个记录文件,在该示例中,开发者也可以使用很多熟悉的命令,利用开发者通常熟悉的调试器对其进行导航。开发者想知道调用该API时发生了什么。开发者步进跳过28行和29行,并且从Locals窗口看到在步进跳过29行后,bestHotels具有零项。如果调试器支持数据提示,则至少在该示例中,开发者也可以查看它们。The developer opens the debugger and loads the SmartHotels360 code and trace file 420. Execution stops at a breakpoint on line 28 in the API that returns to BestHotels. Now, even though this is a log file, in this example, the developer can use many familiar commands to navigate it using a debugger they are typically familiar with. The developer wants to know what happened when the API was called. The developer steps over lines 28 and 29 and sees from the Locals window that after stepping over line 29, bestHotels has zero entries. If the debugger supports data hints, the developer can also view them, at least in this example.

现在,开发者已经确定问题的原因在BestHotels()例程中。因此,开发者希望调查BestHotels()中发生了什么。以另一种调试方法,为了回头看看发生了什么,开发者可以点击继续,再次点击断点,然后步进进入下一BestHotels()的调用,尽管值、对象和存储器地址可能会与被部分地调试的调用有所不同。或者,当调试器状态难以重现时,开发者可以重新启动应用,这可能会花费很多时间。但是在该示例中,环境支持时间旅行调试。因此,开发者使用反向继续按钮(请求向后继续920操作)将应用倒带到先前断点的状态。倒带的一个结果是,在上述步进进行之前,局部将在28行重置为之前的状态。现在,通过确保来自被部分地调试的调用中的所有值、对象和存储器地址相同,开发者可以步进跳过Load()例程并且步进进入BestHotels()。Now, the developer has identified the cause of the problem in the `BestHotels()` routine. Therefore, the developer wants to investigate what happened in `BestHotels()`. Alternatively, to see what happened back to the original call, the developer could click Continue, click the breakpoint again, and step into the next call to `BestHotels()`, even though the values, objects, and memory addresses might differ from the partially debugged call. Alternatively, when the debugger state is difficult to reproduce, the developer could restart the application, which could be time-consuming. However, in this example, the environment supports time-travel debugging. Therefore, the developer uses the Reverse Continue button (requesting to continue backwards 920 operations) to rewind the application to the state of the previous breakpoint. One result of this rewind is that the locale will be reset to its previous state at line 28 before the aforementioned stepping is performed. Now, by ensuring that all values, objects, and memory addresses from the partially debugged call are the same, the developer can skip the `Load()` routine and step into `BestHotels()`.

此时,开发者决定步进通过BestHotels(),并且深入研究GetBestHotels()。因此,开发者希望步进跳过36行,然后步进进入37行。假定开发者不小心多次按下了步进跳过按钮。通过时间旅行调试,开发者可以快速返回并且查看GetBestHotels()中发生了什么。实际上,开发者可以使用向后步进按钮(请求向后步进进入914操作),该按钮会将执行带入GetBestHotels()中,并且向后播放。开发者发现,在GetBestHotels()的末尾,局部变量bestHotels的值(对应于计数)为零。显然,所有等级都被过滤掉了。At this point, the developer decides to step through `BestHotels()` and delve deeper into `GetBestHotels()`. Therefore, the developer wants to skip line 36 and then step into line 37. Suppose the developer accidentally pressed the skip button multiple times. Through time travel debugging, the developer can quickly go back and see what happened in `GetBestHotels()`. In fact, the developer can use the backstep button (requesting to step back into operation 914), which will take execution into `GetBestHotels()` and play it backward. The developer discovers that at the end of `GetBestHotels()`, the value of the local variable `bestHotels` (corresponding to the count) is zero. Clearly, all levels were filtered out.

因此,开发者决定通过检查以查看所有酒店的等级,从而检验假定。请记住,该跟踪是生产中发生的,因此这些值是实际值。开发者可以使用调试器的即时窗口来评估表达式,这可以通过实时调试过程来实现。开发者在调试器的即时窗口中评估表达式“AllHotels.Select(h=>h.rating)”,并且发现等级是浮点的,而代码正在检查等于整数4或5的等级值。数据类型不匹配,生产中的数据形状与应用期望之间不匹配。Therefore, the developers decided to test the assumption by checking the ratings of all hotels. Remember, this trace occurred in production, so these values are actual. The developers can evaluate the expression using the debugger's live window, which is possible through the live debugging process. The developers evaluated the expression "AllHotels.Select(h => h.rating)" in the debugger's live window and found that the ratings were floating-point numbers, while the code was checking for rating values equal to integers 4 or 5. There was a data type mismatch; the shape of the data in production did not match the application's expectations.

现在假定开发者已经完成了刚刚描述的调试,并且想与同事讨论并且详细向同事展示发生了什么。开发者希望在调查开始时再次开始,并且希望有一种方法可以快速回到特定兴趣点。因此,开发者在21行设置了断点,然后倒回该断点。然后,重放将允许开发者重新再现调试步骤。如果开发者想跳到最后,则开发者可以继续前进,直到开发者设定的最后断点。Now suppose the developer has completed the debugging described above and wants to discuss it with a colleague and show them in detail what happened. The developer wants to start over at the beginning of the investigation and wants a way to quickly return to a specific point of interest. Therefore, the developer sets a breakpoint on line 21 and then rewinds to that breakpoint. Replaying then allows the developer to reproduce the debugging steps. If the developer wants to jump to the end, they can continue until they reach the last breakpoint they set.

简而言之,开发者能够使用应用的高保真跟踪418快速调试问题,该记录捕获了生产中实际出了什么问题。借助被适配于这里所述的重放的调试器的权力,开发者能够使用熟悉的调试器用户界面进行调试,并且能够向前和向后进行调试,从而节省了大量的开发者时间。In short, developers can use the application's high-fidelity tracing 418 to quickly debug issues, capturing what actually happened in production. With the power of a debugger adapted to the replay described here, developers can debug using a familiar debugger user interface and can debug forward and backward, saving significant developer time.

结论in conclusion

尽管在此将特定实施例明确地示出和描述为过程、所配置的介质或系统,但是应当理解,对一种类型的实施例的讨论通常还扩展到一些其他实施例类型。例如,结合图13和14进行的过程描述也有助于描述配置的介质,并且有助于描述与结合其他附图所讨论的那些类似的系统和制造的技术效果和操作。并非必然地,必须将来自一个实施例的限制读入另一实施例。特别地,过程不必限于在讨论诸如配置的存储器等系统或制造时所呈现的数据结构和布置。Although specific embodiments are explicitly shown and described herein as processes, configured media, or systems, it should be understood that the discussion of one type of embodiment generally extends to several other types of embodiments. For example, the process descriptions taken in conjunction with Figures 13 and 14 also help to describe the configured media and to describe the technical effects and operation of those similar systems and manufactures discussed in conjunction with the other figures. It is not necessarily required that limitations from one embodiment be read into another. In particular, processes are not necessarily limited to the data structures and arrangements presented when discussing systems or manufactures such as configured memory.

本领域技术人员将理解,实现细节可以与特定代码有关,诸如特定API、特定领域、和特定样本程序,并且因此不一定在每个实施例中都出现。本领域技术人员还将理解,在讨论细节时使用的程序标识符和一些其他术语是特定于实现的,因此不一定与每个实施例有关。尽管如此,尽管这里不一定要求它们存在,但是这样的细节可以通过提供上下文来帮助一些读者,和/或可以说明本文中讨论的技术的很多可能的实现中的一些实现。Those skilled in the art will understand that implementation details may relate to specific code, such as a specific API, a specific domain, and a specific sample program, and therefore may not necessarily appear in every embodiment. Those skilled in the art will also understand that program identifiers and some other terms used in discussing details are implementation-specific and therefore not necessarily related to every embodiment. Nevertheless, while their presence is not necessarily required herein, such details can assist some readers by providing context and/or can illustrate some of the many possible implementations of the techniques discussed herein.

本文中对具有一些特征X的一个实施例的引用以及本文中其他地方对具有一些特征Y的实施例的引用并不排除同时具有特征X和特征Y的实施例,除非本文中明确指出了这种排除。所有可能的否定权利要求限制都在本公开的范围内,因为即使在本文中的任何示例中未给出特定排除,也可以将被规定为一个实施例的一部分的任何特征从一些其他实施例中明确删除。术语“实施例”在本文中仅用作“过程、系统、制品、配置的计算机可读介质和/或以与适用法律相一致的方式应用的本文中的教导的其他示例”的更方便形式。因此,给定“实施例”可以包括本文中公开的特征的任何组合,只要该实施例与至少一个权利要求相一致。References herein to an embodiment having some feature X, and references elsewhere herein to an embodiment having some feature Y, do not exclude embodiments having both feature X and feature Y, unless such exclusion is expressly indicated herein. All possible limitations of the claims are within the scope of this disclosure, as any feature that is prescribed as part of an embodiment may be expressly removed from some other embodiment, even if no specific exclusion is given in any example herein. The term “embodiment” is used herein only as a more convenient form of “process, system, article of manufacture, computer-readable medium of configuration and/or other example of the teachings herein applied in a manner consistent with applicable law.” Therefore, a given “embodiment” may include any combination of features disclosed herein, provided that the embodiment is consistent with at least one claim.

在每个实施例中,并非图中所示的每个项都必须被呈现。相反,一个实施例可以包含未在图中明确示出的项。尽管这里通过特定示例在文本和附图中示出了一些可能性,但是实施例可以脱离这些示例。例如,示例的特定技术效果或技术特征可以被省略,重命名,不同地分组,重复,在硬件和/或软件中不同地实例化,或者是出现在两个或更多个示例中的效果或特征的混合。在一些实施例中,在一个位置处示出的功能也可以在不同的位置处提供;例如,本领域技术人员认识到,可以在给定实现中以各种方式定义功能模块,而不必从被视为一个整体的交互模块集合中忽略所需要的技术效果。In each embodiment, not every item shown in the figures must be presented. Instead, an embodiment may include items not explicitly shown in the figures. Although some possibilities are illustrated herein by way of specific examples in the text and figures, embodiments may deviate from these examples. For example, specific technical effects or features of an example may be omitted, renamed, grouped differently, repeated, instantiated differently in hardware and/or software, or a mixture of effects or features appearing in two or more examples. In some embodiments, functionality shown in one location may also be provided in different locations; for example, those skilled in the art will recognize that functional modules can be defined in various ways in a given implementation without having to omit the desired technical effects from a collection of interactive modules considered as a whole.

在全文中通过引用标号对附图进行了引用。在附图或文本中,与给定附图标记相关的措词中的任何明显不一致之处应当被理解为简单地扩大了该数字所引用的范围。即使使用相同的附图标记,给定附图标记的不同实例也可以指代不同的实施例。类似地,给定附图标记The figures are referenced throughout the text using reference numerals. Any apparent inconsistencies in the wording related to a given figure reference in the figures or text should be understood as simply broadening the scope of the number referred to. Even when using the same figure reference, different instances of a given figure reference may refer to different embodiments. Similarly, given figure references...

可以用于指代动词、名词和/或每个的对应实例,例如,处理器110It can be used to refer to verbs, nouns, and/or corresponding instances of each, for example, processor 110.

可以通过执行指令来处理110指令。Instruction 110 can be processed by executing instructions.

如本文中使用的,诸如“一个”和“该”等术语包括所指示的项或步骤中的一个或多个。特别地,在权利要求中,对项的引用通常是指存在至少一个这样的项,而对步骤的引用表示执行该步骤的至少一个实例。As used herein, terms such as “an” and “the” include one or more of the indicated item or step. In particular, in the claims, a reference to an item generally means that there is at least one such item, while a reference to a step indicates at least one instance of performing that step.

标题仅是为了方便;可以在标题表明该主题的部分之外找到有关给定主题的信息。The headings are for convenience only; information about a given topic can be found outside of the sections that indicate the subject in the headings.

所提交的所有权利要求书和摘要是说明书的一部分。All claims and abstracts submitted are part of the specification.

尽管已经在附图中示出并且在上面描述了示例性实施例,但是对于本领域的普通技术人员很清楚的是,在不脱离权利要求中阐述的原理和概念的情况下,可以进行多种修改,并且这样的修改不一定包含整个抽象概念。尽管以特定于结构特征和/或程序动作的语言描述了主题,但应当理解,所附权利要求书中定义的主题不必限于权利要求书中所述的特定技术特征或动作。在给定定义或示例中标识的每个手段或方面或技术效果不必在每个实施例中都呈现或被利用。而是,所描述的特定特征以及作用和效果作为示例被公开,以在实现权利要求时考虑。Although exemplary embodiments have been shown in the accompanying drawings and described above, it will be apparent to those skilled in the art that various modifications may be made without departing from the principles and concepts set forth in the claims, and such modifications do not necessarily encompass the entire abstract concept. Although the subject matter has been described in language specific to structural features and/or procedural actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific technical features or actions described in the claims. Each means or aspect or technical effect identified in a given definition or example need not be presented or utilized in every embodiment. Rather, the specific features, actions, and effects described are disclosed as examples for consideration in implementing the claims.

在法律允许的最大范围内,所有落入整个抽象概念但落入权利要求等同含义和范围之内的改变都应当被包含在其范围之内。To the maximum extent permitted by law, all changes that fall within the entire abstract concept but fall within the equivalent meaning and scope of the claims should be included within its scope.

Claims (20)

1.一种跟踪重放执行控制系统,包括:1. A tracking and playback execution control system, comprising: 处理器;processor; 与所述处理器可操作通信的存储器;A memory operable and communicative with the processor; 在结合对程序的运行时和内核的调用的对所述程序的执行期间被记录的跟踪,其中所述跟踪包括跟踪条目,所述跟踪条目包括由在所述程序的至少一个线程中执行的本机代码指令的活动的记录,其中当所述程序被执行时所述本机代码指令的所述活动被跟踪,并且其中所述跟踪不包括所述程序的所述运行时的任何执行实例;The trace recorded during the execution of the program in combination with calls to the program runtime and the kernel, wherein the trace includes trace entries that include a record of the activity of native code instructions executed in at least one thread of the program, wherein the activity of the native code instructions is traced when the program is executed, and wherein the trace does not include any execution instances of the program runtime. 所述程序的至少一部分的源代码;At least a portion of the source code of the program; 源中间映射,其在所述程序的所述至少一部分的所述源代码与所述程序的所述至少一部分的所述源代码的中间表示之间自动地进行映射;Source intermediate mapping, which automatically maps between the source code of the at least portion of the program and an intermediate representation of the source code of the at least portion of the program; 中间本机映射,其在所述程序的所述至少一部分的所述源代码的所述中间表示与所述跟踪之间自动地进行映射;以及Intermediate native mapping, which automatically maps between the intermediate representation of the source code of at least a portion of the program and the tracing; and 软件工具中的执行控制器,其中所述执行控制器被配置为,在由所述处理器执行时,响应于接收到跟踪重放执行控制请求而控制所述跟踪的重放执行,其中所述源代码通过所述源中间映射和所述中间本机映射与所述跟踪条目相关联。An execution controller in a software tool, wherein the execution controller is configured to control the replay execution of the trace in response to receiving a trace replay execution control request when executed by the processor, wherein the source code is associated with the trace entry through the source intermediate map and the intermediate native map. 2.根据权利要求1所述的跟踪重放执行控制系统,其中所述执行控制器还被配置为将针对至少以下操作的请求转换为跟踪本机代码指令的对应执行:2. The tracking replay execution control system of claim 1, wherein the execution controller is further configured to translate requests for at least the following operations into corresponding executions of tracking native code instructions: 向前执行步进进入操作;Perform a forward step-in operation; 向前执行步进退出操作;以及Execute the step-out operation forward; and 向前执行步进跳过操作。Perform a step-skip operation forward. 3.根据权利要求1所述的跟踪重放执行控制系统,其中所述执行控制器还被配置为将针对至少以下操作的请求转换为跟踪本机代码指令的对应执行:3. The tracking replay execution control system of claim 1, wherein the execution controller is further configured to translate requests for at least the following operations into corresponding executions of tracking native code instructions: 向后执行步进进入操作;Perform a backward step-in operation; 向后执行步进退出操作;以及Perform a step-out operation backward; and 向后执行步进跳过操作。Perform a step-skip operation backward. 4.根据权利要求1所述的跟踪重放执行控制系统,其中所述执行控制器还被配置为将针对至少以下操作的请求转换为跟踪本机代码指令的对应执行:4. The tracking replay execution control system of claim 1, wherein the execution controller is further configured to translate requests for at least the following operations into corresponding executions of tracking native code instructions: 在所述跟踪中继续向前执行直到断点范围中的位置被到达,以及The tracing continues forward until a position within the breakpoint range is reached, and 在所述跟踪中继续向后执行直到断点范围中的位置被到达。The tracing continues backward until the position within the breakpoint range is reached. 5.根据权利要求1所述的跟踪重放执行控制系统,其中所述跟踪重放执行控制系统被配置为步进进入所述程序的所述至少一部分的所述源代码的一部分,所述源代码的一部分在所述跟踪的重放执行期间尚未被编译为本机代码指令。5. The tracking replay execution control system of claim 1, wherein the tracking replay execution control system is configured to step into a portion of the source code of at least a portion of the program, the portion of the source code not yet compiled into native code instructions during the replay execution of the tracking. 6.根据权利要求1所述的跟踪重放执行控制系统,其中所述程序的所述至少一部分的所述源代码的所述中间表示包括以下至少一项:6. The tracking replay execution control system of claim 1, wherein the intermediate representation of the source code of the at least portion of the program comprises at least one of the following: 将在所述程序的所述至少一部分的所述源代码中使用的至少两个标识符与数据类型相关联的符号表;A symbol table that associates at least two identifiers used in at least a portion of the source code of the program with data types; 从所述程序的所述至少一部分的所述源代码的至少一部分导出的抽象语法树;或An abstract syntax tree derived from at least a portion of the source code of the program; or 所述程序的所述至少一部分的所述源代码的至少一部分到中间语言的转换。The conversion of at least a portion of the source code of the program into an intermediate language. 7.根据权利要求1所述的跟踪重放执行控制系统,其中所述跟踪不包含所述程序的所述运行时的任何执行实例,因为所述跟踪重放执行控制系统未被配置为调用所述跟踪以执行特定于所述程序的所述运行时的任何代码。7. The trace replay execution control system of claim 1, wherein the trace does not contain any execution instance of the program's runtime, because the trace replay execution control system is not configured to invoke the trace to execute any code specific to the program's runtime. 8.根据权利要求1所述的跟踪重放执行控制系统,还包括具有所述程序的所述运行时的可调用实例的所述程序的实时过程,其中所述跟踪从所述程序的所述实时过程被记录并且所述跟踪重放执行控制系统被配置为重放从所述程序的所述实时过程所记录的所述跟踪的执行。8. The tracking replay execution control system of claim 1, further comprising a real-time process of the program having a callable instance of the program at runtime, wherein the tracking is recorded from the real-time process of the program and the tracking replay execution control system is configured to replay the execution of the tracking recorded from the real-time process of the program. 9.根据权利要求1所述的跟踪重放执行控制系统,其中所述跟踪重放执行控制系统被配置为略过所述跟踪的一部分的重放执行,因为所述执行控制器将所述跟踪的所述一部分的所述重放执行从所述跟踪的第一执行时间点移动到所述跟踪的第二执行时间点,而所述跟踪重放执行控制系统没有执行本会通过从所述跟踪的所述第一执行时间点到所述跟踪的所述第二执行时间点的继续执行而被执行的跟踪本机代码指令。9. The tracking replay execution control system of claim 1, wherein the tracking replay execution control system is configured to skip a portion of the tracking replay execution because the execution controller moves the replay execution of the portion of the tracking from a first execution time point of the tracking to a second execution time point of the tracking, and the tracking replay execution control system does not execute tracking native code instructions that would otherwise be executed by continuing execution from the first execution time point of the tracking to the second execution time point of the tracking. 10.一种跟踪重放执行控制方法,包括:10. A method for tracking and replaying execution control, comprising: 标识所跟踪的被管理程序,所述所跟踪的被管理程序被配置为结合对所述所跟踪的被管理程序的运行时和内核的调用来执行、并且被配置为在执行期间要被跟踪;Identify the managed program being tracked, the managed program being tracked being configured to execute in conjunction with runtime and kernel calls to the managed program being tracked during execution; 接收跟踪重放执行控制请求,其中所述跟踪重放执行控制请求在计算系统上运行的软件工具中被接收;Receive a trace replay execution control request, wherein the trace replay execution control request is received in a software tool running on a computing system; 基于接收到所述跟踪重放执行控制请求,在所述所跟踪的被管理程序的源代码与所述所跟踪的被管理程序的所述源代码的中间表示之间自动地进行映射,并且在所述所跟踪的被管理程序的所述源代码的所述中间表示与在所述所跟踪的被管理程序的所述执行期间所记录的跟踪之间自动地进行映射,其中所述跟踪包括跟踪条目,所述跟踪条目包括:由至少一个处理器在所述所跟踪的被管理程序的至少一个线程中执行的本机代码指令的活动的记录,其中当所述所跟踪的被管理程序被执行时所述本机代码指令的所述活动被跟踪,并且其中所述跟踪不包括所述所跟踪的被管理程序的所述运行时的任何执行实例;以及Based on the received trace replay execution control request, an automatic mapping is performed between the source code of the traced managed program and an intermediate representation of the source code of the traced managed program, and an automatic mapping is performed between the intermediate representation of the source code of the traced managed program and a trace recorded during the execution of the traced managed program, wherein the trace includes trace entries, the trace entries including: a record of the activity of native code instructions executed by at least one processor in at least one thread of the traced managed program, wherein the activity of the native code instructions is traced when the traced managed program is executed, and wherein the trace does not include any execution instance of the runtime of the traced managed program; and 执行与所述跟踪重放执行控制请求相对应的跟踪本机代码指令,其中所述源代码通过源中间映射和所述中间本机映射与所述跟踪条目相关联,从而重放所述跟踪的一部分的执行。Execute trace native code instructions corresponding to the trace replay execution control request, wherein the source code is associated with the trace entry through a source intermediate map and the intermediate native map, thereby replaying the execution of a portion of the trace. 11.根据权利要求10所述的跟踪重放执行控制方法,其中所述跟踪重放执行控制请求标识向后执行步进退出操作,以步进退出例程,并且所述跟踪重放执行控制方法还包括在跟踪本机代码指令上设置断点,所述断点具有紧接在对所述例程的调用的返回地址的位置之前的位置,并且其中当在跟踪的向前执行期间在B之前遇到A并且A与B之间存在至多五个跟踪本机代码指令时,在所述跟踪中位置A紧接在位置B之前。11. The trace replay execution control method of claim 10, wherein the trace replay execution control request indicates a backward step-out operation to step out of the routine, and the trace replay execution control method further includes setting a breakpoint on the trace native code instruction, the breakpoint having a position immediately preceding the return address of the call to the routine, and wherein position A in the trace immediately precedes position B when A is encountered before B during forward execution of the trace and there are at most five trace native code instructions between A and B. 12.根据权利要求10所述的跟踪重放执行控制方法,其中所述所跟踪的被管理程序的所述源代码包含语句和表达式,其中所述跟踪重放执行控制方法还包括在跟踪本机代码指令上设置断点,所述断点在一组全部跟踪本机代码指令的边缘上,所述全部跟踪本机代码指令由所述跟踪重放执行控制方法映射到所述所跟踪的被管理程序的所述源代码中的给定语句或给定表达式,并且其中当跟踪中的一组指令G中的指令X满足以下条件中的至少一个条件时,X在G的边缘上:12. The trace replay execution control method of claim 10, wherein the source code of the traced managed program comprises statements and expressions, wherein the trace replay execution control method further comprises setting breakpoints on trace native code instructions, the breakpoints being on the edge of a set of all trace native code instructions, the all trace native code instructions being mapped by the trace replay execution control method to a given statement or a given expression in the source code of the traced managed program, and wherein X is on the edge of G when instruction X in a set of instructions G being traced satisfies at least one of the following conditions: X是在所述跟踪的向前执行期间遇到的G的第一指令;X is the first instruction of G encountered during the forward execution of the trace; X是在所述跟踪的向前执行期间遇到的G的最后指令;X is the last instruction of G encountered during the forward execution of the trace; X是在所述跟踪的向后执行期间遇到的G的第一指令;或者X is the first instruction of G encountered during the backward execution of the trace; or X是在所述跟踪的向后执行期间遇到的G的最后指令。X is the last instruction of G encountered during the backward execution of the trace. 13.根据权利要求12所述的跟踪重放执行控制方法,其中所述跟踪重放执行控制请求调用以下中的一项:13. The tracking replay execution control method according to claim 12, wherein the tracking replay execution control request invokes one of the following: 向前执行步进跳过操作,以向前步进跳过例程;Perform a forward step skip operation to skip the routine step by step; 向后执行步进跳过操作,以向后步进跳过例程;Perform a backward step skip operation to skip the routine step by step; 向前执行步进进入操作,以向前步进进入例程;或者Perform a forward step-in operation to step into the forward step-in routine; or 向后执行步进进入操作,以向后步进进入例程。Perform a backward step-in operation to step into the backward step-in routine. 14.根据权利要求10所述的跟踪重放执行控制方法,其中所述跟踪重放执行控制请求标识向前执行步进进入操作,以步进进入用户代码例程,其中所述用户代码例程的重放执行包括对运行时例程的至少一个调用的重放执行,其中对所述运行时例程的所述至少一个调用在所述所跟踪的被管理程序的所述源代码中没有对应的调用语句或调用表达式,并且其中所述跟踪重放执行控制方法还包括以下至少一项:14. The trace replay execution control method of claim 10, wherein the trace replay execution control request identifies a forward execution step-in operation to step into a user code routine, wherein the replay execution of the user code routine includes the replay execution of at least one call to a runtime routine, wherein the at least one call to the runtime routine has no corresponding call statement or call expression in the source code of the traced managed program, and wherein the trace replay execution control method further comprises at least one of the following: 设置断点范围,所述断点范围指明被指定为接收动态编译代码的整个存储器范围;或者Set a breakpoint range that specifies the entire memory range designated to receive dynamically compiled code; or 设置断点,以对所述运行时例程的所述至少一个调用执行步进跳过操作。Set breakpoints to perform step-skip operations on at least one call to the runtime routine. 15.根据权利要求10所述的跟踪重放执行控制方法,其中所述跟踪重放执行控制请求调用以下操作中的至少一个操作:15. The tracking replay execution control method according to claim 10, wherein the tracking replay execution control request invokes at least one of the following operations: 在所述跟踪中向前继续跟踪重放执行,直到断点被达到;The replay execution continues forward during the tracing process until the breakpoint is reached. 在所述跟踪中向前继续跟踪重放执行,直到断点范围内的位置被达到;The replay execution continues forward during the tracing until the position within the breakpoint range is reached. 在所述跟踪中向后继续跟踪重放执行,直到断点被达到;The execution is replayed and traced backwards during the tracing process until a breakpoint is reached. 在所述跟踪中向后继续跟踪重放执行,直到断点范围内的位置被达到;The replay execution continues to be traced backward until the position within the breakpoint range is reached. 向后执行步进进入操作;Perform a backward step-in operation; 向后执行步进退出操作;Perform a step-out operation backward; 向后执行步进跳过操作;Perform a step-skip operation backward; 向前执行步进进入操作;Perform a forward step-in operation; 向前执行步进退出操作;或者Execute the step-out operation forward; or 向前执行步进跳过操作。Perform a step-skip operation forward. 16.根据权利要求10所述的跟踪重放执行控制方法,其中在所述所跟踪的被管理程序的所述执行期间,断点的最大数目受处理器能够一次监测至多N个地址这一硬件断点约束的约束,并且其中所述跟踪重放执行控制方法还包括在所述跟踪的所述一部分的重放执行期间设置多于N个断点,从而超出所述硬件断点约束。16. The trace replay execution control method of claim 10, wherein during the execution of the traced managed program, the maximum number of breakpoints is constrained by a hardware breakpoint constraint that the processor can monitor up to N addresses at a time, and wherein the trace replay execution control method further includes setting more than N breakpoints during the replay execution of the traced portion, thereby exceeding the hardware breakpoint constraint. 17.一种计算机可读存储介质,所述计算机可读存储介质存储有数据和指令,所述数据和所述指令在由与存储器可操作通信的处理器执行时执行跟踪重放执行控制方法,所述跟踪重放执行控制方法包括:17. A computer-readable storage medium storing data and instructions, the data and instructions executing a trace-replay execution control method when executed by a processor operably in communication with the memory, the trace-replay execution control method comprising: 标识所跟踪的被管理程序,所述所跟踪的被管理程序被配置为结合对所述所跟踪的被管理程序的运行时和内核的调用来执行、并且被配置为在执行期间要被跟踪;Identify the managed program being tracked, the managed program being tracked being configured to execute in conjunction with runtime and kernel calls to the managed program being tracked during execution; 接收跟踪重放执行控制请求,其中所述跟踪重放执行控制请求在计算系统上运行的软件工具中被接收;Receive a trace replay execution control request, wherein the trace replay execution control request is received in a software tool running on a computing system; 基于接收到所述跟踪重放执行控制请求,在所述所跟踪的被管理程序的源代码与所述所跟踪的被管理程序的所述源代码的中间表示之间自动地进行映射,并且在所述所跟踪的被管理程序的所述源代码的所述中间表示与在所述所跟踪的被管理程序的所述执行期间所记录的跟踪之间自动地进行映射,其中所述跟踪包括跟踪条目,所述跟踪条目包括:由至少一个处理器在所述所跟踪的被管理程序的至少一个线程中执行的本机代码指令的活动的记录,其中当所述所跟踪的被管理程序被执行时所述本机代码指令的所述活动被跟踪,并且其中所述跟踪不包括所述所跟踪的被管理程序的所述运行时的任何执行实例;以及Based on the received trace replay execution control request, an automatic mapping is performed between the source code of the traced managed program and an intermediate representation of the source code of the traced managed program, and an automatic mapping is performed between the intermediate representation of the source code of the traced managed program and a trace recorded during the execution of the traced managed program, wherein the trace includes trace entries, the trace entries including: a record of the activity of native code instructions executed by at least one processor in at least one thread of the traced managed program, wherein the activity of the native code instructions is traced when the traced managed program is executed, and wherein the trace does not include any execution instance of the runtime of the traced managed program; and 执行与所述跟踪重放执行控制请求相对应的跟踪本机代码指令,或者在跟踪本机代码指令上设置断点,其中所述源代码通过源中间映射和所述中间本机映射与所述跟踪条目相关联,从而控制所述跟踪的重放执行。Execute trace native code instructions corresponding to the trace replay execution control request, or set breakpoints on trace native code instructions, wherein the source code is associated with the trace entry through a source intermediate map and the intermediate native map, thereby controlling the replay execution of the trace. 18.根据权利要求17所述的计算机可读存储介质,其中所述所跟踪的被管理程序与调试器代码相组合,包括实时过程和所述所跟踪的被管理程序的执行运行时,并且其中所述调试器代码与所述所跟踪的被管理程序的所述执行运行时通信,并且所述跟踪重放执行控制方法还包括在没有终止所述所跟踪的被管理程序的情况下使用所述跟踪控制向后执行重放。18. The computer-readable storage medium of claim 17, wherein the traced managed program is combined with debugger code, including a real-time process and the execution runtime of the traced managed program, and wherein the debugger code communicates with the execution runtime of the traced managed program, and the trace replay execution control method further includes using the trace control to perform a replay backward without terminating the traced managed program. 19.根据权利要求17所述的计算机可读存储介质,其中所述跟踪重放执行控制方法还包括以下执行控制活动中的至少两个执行控制活动:19. The computer-readable storage medium of claim 17, wherein the trace replay execution control method further comprises at least two of the following execution control activities: 使用所述跟踪中的机器级别信息来在高级别控制所述所跟踪的被管理程序的所述运行时的执行,其中在高级别控制所述所跟踪的被管理程序的所述运行时的所述执行是指基于用户选择来控制,所述用户选择指明所述所跟踪的被管理程序的所述源代码中的标识符或语句或表达式,并且所述跟踪中的机器级别信息是指特定于处理器架构的信息;Using machine-level information in the trace to control the execution of the runtime of the traced managed program at a high level, wherein controlling the execution of the runtime of the traced managed program at a high level refers to control based on user selection, the user selection specifying identifiers or statements or expressions in the source code of the traced managed program, and the machine-level information in the trace refers to processor architecture-specific information. 调试所述所跟踪的被管理程序的过程的向前执行和向后执行两者;Debugging both the forward and backward execution of the process of the managed program being traced; 至少部分通过设置大断点范围来步进进入所述所跟踪的被管理程序的所述源代码中示出的调用,其中当断点范围涵盖所述跟踪中的至少一千个连续地址或指令时,所述断点范围是大的;At least in part, stepping into the calls shown in the source code of the traced managed program is achieved by setting a large breakpoint range, wherein the breakpoint range is large when it covers at least one thousand consecutive addresses or instructions in the trace; 当所述跟踪包括例程的本机代码的至少两个版本时,映射到所述例程的本机代码的特定版本;或者When the tracing includes at least two versions of the native code of the routine, it maps to a specific version of the native code of the routine; or 在调试所述所跟踪的被管理程序的实时过程的同时,记录来自所述实时过程的跟踪数据,并且然后使用所记录的所述跟踪数据中的至少一些跟踪数据对所述实时过程执行反向执行调试。While debugging the real-time process of the managed program being tracked, trace data from the real-time process is recorded, and then at least some of the recorded trace data is used to perform reverse execution debugging on the real-time process. 20.根据权利要求17所述的计算机可读存储介质,其中所述跟踪重放执行控制方法还包括以下执行控制活动中的至少三个执行控制活动:20. The computer-readable storage medium of claim 17, wherein the trace replay execution control method further comprises at least three of the following execution control activities: 使用所述跟踪中的机器级别信息来在高级别控制所述所跟踪的被管理程序的所述运行时的执行,其中在高级别控制所述所跟踪的被管理程序的所述运行时的所述执行是指基于用户选择来控制,所述用户选择指明所述所跟踪的被管理程序的所述源代码中的标识符或语句或表达式,并且所述跟踪中的机器级别信息是指特定于处理器架构的信息;Using machine-level information in the trace to control the execution of the runtime of the traced managed program at a high level, wherein controlling the execution of the runtime of the traced managed program at a high level refers to control based on user selection, the user selection specifying identifiers or statements or expressions in the source code of the traced managed program, and the machine-level information in the trace refers to processor architecture-specific information. 调试所述所跟踪的被管理程序的过程的向前执行和向后执行两者;Debugging both the forward and backward execution of the process of the managed program being traced; 至少部分通过设置大断点范围来步进进入所述所跟踪的被管理程序的所述源代码中示出的调用,其中当断点范围涵盖所述跟踪中的至少一千个连续地址或指令时,所述断点范围是大的;At least in part, stepping into the calls shown in the source code of the traced managed program is achieved by setting a large breakpoint range, wherein the breakpoint range is large when it covers at least one thousand consecutive addresses or instructions in the trace; 当所述跟踪包括例程的本机代码的至少两个版本时,映射到所述例程的本机代码的特定版本;或者When the tracing includes at least two versions of the native code of the routine, it maps to a specific version of the native code of the routine; or 在调试所述所跟踪的被管理程序的实时过程的同时,记录来自所述实时过程的跟踪数据,并且然后使用所记录的所述跟踪数据中的至少一些跟踪数据对所述实时过程执行反向执行调试。While debugging the real-time process of the managed program being tracked, trace data from the real-time process is recorded, and then at least some of the recorded trace data is used to perform reverse execution debugging on the real-time process.
HK62021024900.4A 2018-05-02 2019-04-25 Execution control with cross-level trace mapping HK40035552B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US15/969,721 2018-05-02

Publications (2)

Publication Number Publication Date
HK40035552A HK40035552A (en) 2021-05-14
HK40035552B true HK40035552B (en) 2025-10-03

Family

ID=

Similar Documents

Publication Publication Date Title
KR102898770B1 (en) Execution control through cross-level trace mapping
US11249881B2 (en) Selectively tracing portions of computer process execution
US10621068B2 (en) Software code debugger for quick detection of error root causes
EP3785125B1 (en) Selectively tracing portions of computer process execution
US10541042B2 (en) Level-crossing memory trace inspection queries
US20150220422A1 (en) Partial Recording of a Computer Program Execution for Replay
CN102541731B (en) Platform-agnostic diagnostic data collection and display
Watson Writing high-performance. NET code
HK40035552B (en) Execution control with cross-level trace mapping
HK40035552A (en) Execution control with cross-level trace mapping
Kim Dual Execution And Its Applications
Leija Leveraging System Call Interposition for Low-Level Process Manipulation
Vilk Righting Web Development
Perianayagam Reproducing software experiments
Altekar et al. Output-deterministic replay for multicore debugging
Willmore Checkpointing Code for Restartability with HDF5