JP5906609B2 - Debug support program, debug support method, and debug support system - Google Patents

Debug support program, debug support method, and debug support system Download PDF

Info

Publication number
JP5906609B2
JP5906609B2 JP2011179836A JP2011179836A JP5906609B2 JP 5906609 B2 JP5906609 B2 JP 5906609B2 JP 2011179836 A JP2011179836 A JP 2011179836A JP 2011179836 A JP2011179836 A JP 2011179836A JP 5906609 B2 JP5906609 B2 JP 5906609B2
Authority
JP
Japan
Prior art keywords
variable
source code
global
application
static
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2011179836A
Other languages
Japanese (ja)
Other versions
JP2013041546A (en
Inventor
直樹 末安
直樹 末安
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2011179836A priority Critical patent/JP5906609B2/en
Publication of JP2013041546A publication Critical patent/JP2013041546A/en
Application granted granted Critical
Publication of JP5906609B2 publication Critical patent/JP5906609B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、アプリケーションプログラム(以下「アプリケーション」という)に含まれるバグ(不具合)の修正を支援するデバッグ支援プログラム、デバッグ支援方法及びデバッグ支援システムに関する。   The present invention relates to a debugging support program, a debugging support method, and a debugging support system that support correction of a bug (defect) included in an application program (hereinafter referred to as “application”).

アプリケーションの動作結果が意図するものと異なる場合、例えば、アプリケーションが異常終了する場合などは、その原因がアプリケーションに含まれるバグである可能性が高い。このため、アプリケーションの開発過程では、アプリケーションが小規模のものでない限り、バグを取り除くデバッグ作業が不可欠である。大規模なアプリケーションの場合、修正したソースコードからロードモジュールを再度ビルドし、アプリケーションの最初からデバッグ作業を再開すると、ソースコードの修正からデバッグ作業の再開まである程度の時間が必要である。そこで、デバッグ作業を支援するために、デバッグ対象であるアプリケーションを動作させたままアプリケーションを修正するデバッグ技術がある。   When the operation result of the application is different from the intended one, for example, when the application terminates abnormally, there is a high possibility that the cause is a bug included in the application. For this reason, in the application development process, unless the application is small, debugging work to remove bugs is indispensable. In the case of a large-scale application, when a load module is rebuilt from the corrected source code and the debugging operation is restarted from the beginning of the application, a certain amount of time is required from the correction of the source code to the restarting of the debugging operation. Accordingly, there is a debugging technique for correcting an application while operating the application to be debugged in order to support debugging work.

特開平8−179940号公報JP-A-8-179940

しかし、従来のアプリケーションを動的に修正する技術では、動的にリンクを生成して修正箇所を呼び出すものの、修正箇所(関数・手続き)内にネストされた静的変数の値が継承されないという問題点がある。   However, with the technology that dynamically modifies the conventional application, the problem is that the value of the static variable nested in the modification part (function / procedure) is not inherited although the link is dynamically generated and the modification part is called. There is a point.

そこで、本発明の一側面として、アプリケーションの動的な修正において、修正箇所に含まれる、関数内にネストされた静的変数を含む局所的な静的変数の値を継承可能とすることを目的とする。 Therefore, as one aspect of the present invention, in the dynamic modification of an application, an object is to enable inheritance of values of local static variables including static variables nested in a function, which are included in a modification part. And

コンピュータが、アプリケーションプログラムの一部分に対応するソースコードを修正して得られるソースコードに含まれる、関数内にネストされた静的変数を含む局所的な静的変数を、大域変数に変更し、アプリケーションプログラムの処理により静的変数の変数値が格納されたアドレスと、大域変数と、を関連付けて記憶手段に記憶する。また、コンピュータが、アプリケーションプログラムの処理においてアプリケーションプログラムの一部分が呼び出された場合に、静的変数を大域変数に置き換えて得られるソースコードをコンパイルして得られるプログラムが実行されるように設定する。さらに、コンピュータが、アプリケーションプログラムの処理において大域変数が呼び出された場合に、大域変数と関連付けられて記憶手段に記憶されたアドレスから変数値が読み出されるように設定する。 The computer changes local static variables, including static variables nested in functions , included in the source code obtained by modifying the source code corresponding to a part of the application program to global variables. The address where the variable value of the static variable is stored by the processing of the program and the global variable are associated and stored in the storage means. Further, when a part of the application program is called in the processing of the application program, the computer is set so that the program obtained by compiling the source code obtained by replacing the static variable with the global variable is executed. Further, when the global variable is called in the processing of the application program, the computer sets so that the variable value is read from the address associated with the global variable and stored in the storage means.

アプリケーションの動的な修正において、修正箇所に含まれる、関数内にネストされた静的変数を含む局所的な静的変数の値を継承することができる。 In the dynamic modification of an application, the value of a local static variable including a static variable nested in a function, which is included in the modification part, can be inherited.

デバッガが組み込まれるコンピュータシステムの構成図である。It is a block diagram of a computer system in which a debugger is incorporated. ホストコンピュータ及び利用者端末の内部構造の説明図である。It is explanatory drawing of the internal structure of a host computer and a user terminal. デバッグ作業の手順を説明する手順図である。It is a procedure figure explaining the procedure of debugging work. 修正したソースコードをアプリケーションに適用する方法の概念図である。It is a conceptual diagram of the method of applying the corrected source code to an application. 修正したソースコードに含まれる変数の説明図である。It is explanatory drawing of the variable contained in the corrected source code. アプリケーション適用処理のメインルーチンのフローチャートである。It is a flowchart of the main routine of an application application process. パッチをビルドするサブルーチンのフローチャートである。It is a flowchart of a subroutine for building a patch. パッチを転送するサブルーチンのフローチャートである。It is a flowchart of the subroutine which transfers a patch. パッチをアプリケーションへ適用するサブルーチンのフローチャートである。It is a flowchart of the subroutine which applies a patch to an application. 修正したソースコードがどのように処理されるかを説明する説明図である。It is explanatory drawing explaining how the corrected source code is processed.

以下、添付された図面を参照し、本発明を実施するための実施形態について詳述する。
本実施形態でデバッグ対象となるアプリケーションプログラムは、複数のソースコードをコンパイルして得られる複数のプログラム部分により構成される。各プログラム部分が呼び出されると、各プログラム部分に応じた処理が実行される。
Hereinafter, embodiments for carrying out the present invention will be described in detail with reference to the accompanying drawings.
The application program to be debugged in this embodiment is composed of a plurality of program parts obtained by compiling a plurality of source codes. When each program part is called, processing corresponding to each program part is executed.

本実施形態では、アプリケーションの動的な修正において、静的変数の値を継承するために、デバッガとして動作するコンピュータが次のような処理を実行する。
まず、コンピュータが、デバッグ対象であるアプリケーションのうちの修正されたソースコードに基づいてダイナミックリンクライブラリを生成し、生成したダイナミックリンクライブラリについて、静的変数を大域変数に置き換える処理を行なう。ここで、「静的変数」とは、例えば、C言語における“static変数”など、アプリケーションが終了するまで値が保持される変数である。一方、「大域変数」とは、例えば、C言語における“extern変数”など、他のファイルなどで定義された変数を使用するために宣言する外部変数である。また、コンピュータが、静的変数を保持する領域の実際のアドレス(実アドレス)と大域変数とを関連付けて、アプリケーションに対してダイナミックライブラリをリンクする。そして、コンピュータが、アプリケーションについて、ダイナミックリンクライブラリの手続きが実行されるように変更する。
In this embodiment, in dynamic modification of an application, a computer operating as a debugger executes the following process in order to inherit the value of a static variable.
First, a computer generates a dynamic link library based on a modified source code of an application to be debugged, and performs processing for replacing a static variable with a global variable for the generated dynamic link library. Here, the “static variable” is a variable whose value is held until the application is terminated, such as a “static variable” in C language. On the other hand, a “global variable” is an external variable declared to use a variable defined in another file, such as an “extern variable” in C language. Further, the computer links the dynamic library to the application by associating the actual address (real address) of the area holding the static variable with the global variable. Then, the computer changes the application so that the procedure of the dynamic link library is executed.

次に、本実施形態の一例について説明する。
アプリケーションの開発を支援するツールとして、統合開発環境(Integrated Development Environment)が存在する。統合開発環境は、ソースコードの編集、ソースコードの管理、アプリケーションのビルド方法の管理、ビルドの実行、アプリケーションの実行、デバッグ作業のためのデバッガなどの機能を持つ。デバッガは、利用者の指示に応答して、アプリケーションの停止・再開や、変数の値の参照・変更などを行うことができる。デバッグ対象となるアプリケーションは、C言語、FORTRAN言語などの高級言語で記述され、このような高級言語で記述されたプログラムを対象とするデバッグが可能なデバッガは「ソースレベルデバッガ」と呼ばれている。ここでは、デバッガとして、高級言語であるC言語を扱う、ソースレベルデバッガを前提とする。
Next, an example of this embodiment will be described.
An integrated development environment exists as a tool for supporting application development. The integrated development environment has functions such as source code editing, source code management, application build method management, build execution, application execution, and a debugger for debugging. In response to a user instruction, the debugger can stop and restart the application, and reference and change the value of the variable. An application to be debugged is described in a high-level language such as C language or FORTRAN language, and a debugger capable of debugging a program written in such a high-level language is called a “source level debugger”. . Here, it is assumed that the source level debugger handles the high-level language C as the debugger.

図1は、アプリケーション100を実行するホストコンピュータ200(第2の装置)と、ホストコンピュータ200を操作する少なくとも1台の利用者端末300(第1の装置)と、を有するコンピュータシステムにより構築した、統合開発環境400の一例を示す。   FIG. 1 is constructed by a computer system having a host computer 200 (second device) for executing the application 100 and at least one user terminal 300 (first device) for operating the host computer 200. An example of the integrated development environment 400 is shown.

統合開発環境400のデバッガは、ホストコンピュータ200に備えられた内部デバッガ410及び外部デバッガ420と、利用者端末300に備えられたデバッガ制御装置430と、を有する。内部デバッガ410は、アプリケーション100と一体化されたモジュールであって、外部デバッガ420からの指示に応答して、アプリケーション100の実行・停止などを制御する。外部デバッガ420は、アプリケーション100とは別のプロセスとして起動させるモジュールであって、デバッガ制御装置430からの指示に応答して、内部デバッガ410を介してアプリケーション100にアタッチして制御する。デバッガ制御装置430は、利用者へのユーザインターフェースを提供するモジュールであって、利用者の指示に応答して外部デバッガ420に各種指示などを送信する。   The debugger of the integrated development environment 400 includes an internal debugger 410 and an external debugger 420 provided in the host computer 200, and a debugger control device 430 provided in the user terminal 300. The internal debugger 410 is a module integrated with the application 100 and controls execution / stop of the application 100 in response to an instruction from the external debugger 420. The external debugger 420 is a module that is activated as a process separate from the application 100 and is attached to the application 100 via the internal debugger 410 and controlled in response to an instruction from the debugger control device 430. The debugger control device 430 is a module that provides a user interface to the user, and transmits various instructions to the external debugger 420 in response to the user's instructions.

ここで、ホストコンピュータ200及び利用者端末300は、図2に示すように、メモリA、CPU(Central Processing Unit)などのプロセッサB、ハードディスクC、ドライブ装置D及び通信装置Eを有する。メモリA、プロセッサB、ハードディスクC、ドライブ装置D及び通信装置Eは、シリアルATA(AT Attachment)などのバスFにより相互に接続される。ドライブ装置Dは、例えば、CD−ROM(Compact Disk Read Only Memory)、DVD−ROM(Digital Versatile Disk Read Only Memory)などのリムーバブルディスクGからデータを読み込む。リムーバブルディスクGに代えて、フラッシュメモリを内蔵したUSB(Universal Serial Bus)メモリなどを使用することもできる。通信装置Eは、ホストコンピュータ200と利用者端末300とを接続する、例えば、NIC(Network Interface Card)などである。   Here, the host computer 200 and the user terminal 300 include a memory A, a processor B such as a CPU (Central Processing Unit), a hard disk C, a drive device D, and a communication device E, as shown in FIG. The memory A, the processor B, the hard disk C, the drive device D, and the communication device E are connected to each other by a bus F such as serial ATA (AT Attachment). The drive device D reads data from a removable disk G such as a CD-ROM (Compact Disk Read Only Memory) and a DVD-ROM (Digital Versatile Disk Read Only Memory). Instead of the removable disk G, a USB (Universal Serial Bus) memory with a built-in flash memory may be used. The communication device E is, for example, a NIC (Network Interface Card) that connects the host computer 200 and the user terminal 300.

図3は、デバッガを使用したアプリケーション100のデバッグ作業の大まかな手順を示す。なお、デバッグ作業の前提として、デバッグ対象であるアプリケーション100がビルド済みであるものとする。   FIG. 3 shows a rough procedure for debugging the application 100 using the debugger. It is assumed that the application 100 to be debugged is already built as a premise for the debugging work.

ステップ1(図では「S1」と略記する。以下同様。)では、利用者が、デバッガによりアプリケーション100を実行させ、その動作を検証する。なお、デバッグ作業は、アプリケーション100の途中から開始することも可能である。   In step 1 (abbreviated as “S1” in the figure, the same applies hereinafter), the user causes the debugger to execute the application 100 and verifies its operation. The debugging work can be started from the middle of the application 100.

ステップ2では、利用者が、アプリケーション100の動作検証結果に基づいて、アプリケーション100にバグがあるか否かを判断する。そして、利用者がアプリケーション100にバグがあると判断すればステップ3の手順へと進める一方(Yes)、利用者がアプリケーション100にバグがないと判断すればデバッグ作業を終了させる(No)。   In step 2, the user determines whether or not there is a bug in the application 100 based on the operation verification result of the application 100. If the user determines that the application 100 has a bug, the process proceeds to step 3 (Yes), while if the user determines that the application 100 has no bug, the debugging operation is terminated (No).

ステップ3では、利用者が、例えば、変数の値の参照・変更などを通して、バグの原因を究明する。
ステップ4では、利用者が、ソースコードを修正する。
In step 3, the user investigates the cause of the bug, for example, by referring to or changing the value of the variable.
In step 4, the user corrects the source code.

ステップ5では、利用者によるアプリケーション100の再ビルド指示に応答して、デバッガが、ソースコードの修正部分を再ビルドし、これを実行中のアプリケーション100に適用する。その後、ステップ1以降の手順を繰り返す。   In step 5, in response to an instruction to rebuild the application 100 by the user, the debugger rebuilds the corrected portion of the source code and applies it to the application 100 being executed. Then, the procedure after step 1 is repeated.

以上説明したデバッグ作業においては、ステップ5における手順を除き、公知のデバッガを使用したデバッグ手法と同様の処理手順で実行可能である。ステップ1〜4のデバッグ処理手順は、デバッグ処理を自動化するツールをコンピュータに実行させても良い。また、ステップ5の再ビルド指示は、デバッグ処理を実行化するツールの処理により行なわれるものであっても良い。   The debugging operation described above can be executed in the same processing procedure as the debugging method using a known debugger, except for the procedure in step 5. The debugging process procedure of steps 1 to 4 may cause a computer to execute a tool for automating the debugging process. Further, the rebuild instruction in step 5 may be performed by a process of a tool that executes a debugging process.

図4は、図3におけるステップ5の処理、即ち、修正したソースコードを実行中のアプリケーション100に適用する方法の概念を示す。
統合開発環境400に含まれるビルダ・コンパイラ440は、利用者が修正したソースコード500から、パッチとして機能するダイナミックリンクライブラリ600を生成する。
FIG. 4 shows the concept of the process of step 5 in FIG. 3, that is, a method of applying the modified source code to the application 100 being executed.
The builder compiler 440 included in the integrated development environment 400 generates a dynamic link library 600 that functions as a patch from the source code 500 modified by the user.

ソースコード500は、アプリケーション100の動作を規定するプログラムコードである。ソースコード500で規定される実体には、大域変数、局所変数、大域手続き、局所手続きが含まれる。局所変数としては、大別すると、図5に示すように、ファイルに局所的な変数X、手続きに局所的な変数A,Y、ブロックに局所的な変数B,Zが存在する。手続き又はブロックに局所的な変数には、記憶クラスとしてauto(自動)とstatic(静的)が存在する。auto変数(自動変数)は、参照されるたびに生成・初期化されるが、static変数(静的変数)は、アプリケーション100の起動から終了までの間に1つの実体のみが存在する。   The source code 500 is program code that defines the operation of the application 100. The entities defined by the source code 500 include global variables, local variables, global procedures, and local procedures. As shown in FIG. 5, there are local variables X in the file, local variables A and Y in the procedure, and local variables B and Z in the block. For variables that are local to a procedure or block, there are auto and static storage classes. The auto variable (automatic variable) is generated and initialized every time it is referenced, but only one entity exists between the start and end of the application 100 as the static variable (static variable).

ダイナミックリンクライブラリ600は、アプリケーション100の一部となるロードモジュールであって、大域変数、局所変数、大域手続き、局所手続きなどの実体や、変数名、手続き名などの名称情報(リロケーション情報)及びデバッグ情報を含む。   The dynamic link library 600 is a load module that is a part of the application 100, and includes entities such as global variables, local variables, global procedures, and local procedures, name information such as variable names and procedure names (relocation information), and debugging. Contains information.

ビルダ・コンパイラ440により生成されたダイナミックリンクライブラリ600は、デバッガ制御装置430及び外部デバッガ420により、内部デバッガ410に受け渡される。内部デバッガ410は、ダイナミックリンカ450を介して、ダイナミックリンクライブラリ600をアプリケーション100のロードモジュール110にダイナミックリンクする。 The dynamic link library 600 generated by the builder compiler 440 is transferred to the internal debugger 410 by the debugger control device 430 and the external debugger 420 . The internal debugger 410 dynamically links the dynamic link library 600 to the load module 110 of the application 100 via the dynamic linker 450.

次に、図6〜図9のフローチャートを参照し、修正したソースコード500を実行中のアプリケーション100に適用する処理(アプリケーション適用処理)の具体例について説明する。   Next, a specific example of processing (application application processing) for applying the corrected source code 500 to the application 100 being executed will be described with reference to the flowcharts of FIGS.

図6は、アプリケーション適用処理のメインルーチンの一例を示す。
ステップ11では、ビルダ・コンパイラ440が、修正したソースコード500からパッチとしてのダイナミックリンクライブラリ600をビルドする、後述するサブルーチンを実行する。
FIG. 6 shows an example of the main routine of application application processing.
In step 11, the builder compiler 440 executes a subroutine described later, which builds the dynamic link library 600 as a patch from the corrected source code 500.

ステップ12では、デバッガ制御装置430及び外部デバッガ420が協働して、ビルダ・コンパイラ440により生成されたダイナミックリンクライブラリ600を内部デバッガ410に転送する、後述するサブルーチンを実行する。   In step 12, the debugger control device 430 and the external debugger 420 cooperate to execute a subroutine to be described later, which transfers the dynamic link library 600 generated by the builder compiler 440 to the internal debugger 410.

ステップ13では、内部デバッガ410が、ダイナミックリンクライブラリ600を実行中のアプリケーション100に適用する、後述するサブルーチンを実行する。
図7は、ビルダ・コンパイラ440が実行するサブルーチンの一例を示す。
In step 13, the internal debugger 410 executes a subroutine to be described later that is applied to the application 100 that is executing the dynamic link library 600.
FIG. 7 shows an example of a subroutine executed by the builder compiler 440.

ステップ21では、ビルダ・コンパイラ440が、アプリケーション100に関するすべてのソースコード500の中から、利用者によって修正されたソースコード500を特定する。ソースコード500の特定は、公知の差分ビルド手法と同様に、各ソースコード500のタイムスタンプと、各ソースコード500をコンパイルしたオブジェクトコードのタイムスタンプと、を比較することで容易に実現することができる。なお、ソースコード500の特定単位としては、ファイル単位であってもよい。   In step 21, the builder compiler 440 identifies the source code 500 modified by the user from all the source codes 500 related to the application 100. The identification of the source code 500 can be easily realized by comparing the time stamp of each source code 500 with the time stamp of the object code compiled from each source code 500, as in the known differential build method. it can. The specific unit of the source code 500 may be a file unit.

ステップ22では、ビルダ・コンパイラ440が、アプリケーション100のパッチとして、ステップ21で特定されたソースコード500から、ダイナミックリンクライブラリ600を生成する。このとき、ビルダ・コンパイラ440は、修正されたソースコード500について、静的変数をユニークな名称を付した大域変数に置き換えると共に、大域手続きをユニークな名称を付した大域手続きに置き換えて、ダイナミックリンクライブラリ600を生成する。ここで、静的変数名及び大域手続き名をユニークな名称に置き換える理由としては、アプリケーション100における静的変数及び大域手続きの独自性を保証するためである。なお、ダイナミックリンクライブラリ600の生成は、一時的なソースコード500において静的変数及び大域手続きの置き換えを行って実行してもよく、また、静的変数及び大域手続きの置き換えを実際に行わずに、置き換えたものとみなして実行してもよい。   In step 22, the builder compiler 440 generates a dynamic link library 600 from the source code 500 specified in step 21 as a patch of the application 100. At this time, the builder compiler 440 dynamically replaces the modified source code 500 by replacing the static variable with a global variable with a unique name and the global procedure with a global procedure with a unique name. A library 600 is generated. Here, the reason for replacing the static variable name and the global procedure name with a unique name is to guarantee the uniqueness of the static variable and the global procedure in the application 100. The generation of the dynamic link library 600 may be executed by replacing static variables and global procedures in the temporary source code 500, or without actually replacing static variables and global procedures. , And may be executed as if they were replaced.

ここで、具体例を使用して、ソースコード500における静的変数及び大域手続きの置き換え処理について説明する。
図5に示すソースコードにおいて、静的変数は、ファイルに局所的な変数X、手続きに局所的な変数Y、ブロックに局所的な変数Zであり、大域手続きは、手続き“func”である。静的変数X、Y及びZについて、図10に示すように、“static”を“extern”に置き換えて大域変数化すると共に、大域変数化された変数X、Y及びZをユニークな名称を付した名称に置き換える。また、大域手続き “func”について、ユニークな名称“XX_func”に置き換える。なお、静的変数及び大域手続きの置き換えに際しては、図10に示すような名称への置き換えに限らず、予め決められた規則に則った名称への置き換えでもよい。
Here, replacement processing of static variables and global procedures in the source code 500 will be described using a specific example.
In the source code shown in FIG. 5, the static variables are a variable X local to the file, a variable Y local to the procedure, a variable Z local to the block, and the global procedure is the procedure “func”. For static variables X, Y, and Z, as shown in FIG. 10, “static” is replaced with “extern” to make it a global variable, and variables X, Y, and Z that have been made global variables are given unique names. Replace with the name. Also, replace the global procedure “func” with a unique name “XX_func”. The replacement of the static variable and the global procedure is not limited to the name as shown in FIG. 10, but may be performed according to a predetermined rule.

図8は、デバッガ制御装置430及び外部デバッガ420が協働して実行するサブルーチンの一例を示す。
ステップ31では、デバッガ制御装置430及び外部デバッガ420が協働して、ビルダ・コンパイラ440により生成されたダイナミックリンクライブラリ600をアプリケーション100の内部デバッガ410に転送する。具体的には、デバッガ制御装置430が、ダイナミックリンクライブラリ600を外部デバッガ420に転送すると共に、外部デバッガ420が、デバッガ制御装置430から転送されたダイナミックリンクライブラリ600を内部デバッガ410に転送する。
FIG. 8 shows an example of a subroutine that the debugger control device 430 and the external debugger 420 execute in cooperation.
In step 31, the debugger controller 430 and the external debugger 420 cooperate to transfer the dynamic link library 600 generated by the builder compiler 440 to the internal debugger 410 of the application 100. Specifically, the debugger control device 430 transfers the dynamic link library 600 to the external debugger 420, and the external debugger 420 transfers the dynamic link library 600 transferred from the debugger control device 430 to the internal debugger 410.

図9は、内部デバッガ410が実行するサブルーチンの一例を示す。
ステップ41では、内部デバッガ410が、大域変数化された静的変数について、DWARF情報などのデバッグ情報を参照し、実行中のアプリケーション100における実アドレスを求める。
FIG. 9 shows an example of a subroutine executed by the internal debugger 410.
In step 41, the internal debugger 410 refers to debug information such as DWARF information for a static variable that has been converted to a global variable, and obtains a real address in the application 100 being executed.

ステップ42では、内部デバッガ410が、ステップ41で求めた静的変数の実アドレスと大域変数とを関連付けてダイナミックリンカ450に伝え、ダイナミックリンク処理でダイナミックリンクライブラリ600を利用可能とする。   In step 42, the internal debugger 410 associates the real address of the static variable obtained in step 41 with the global variable and transmits it to the dynamic linker 450 to make the dynamic link library 600 available for dynamic link processing.

ステップ43では、内部デバッガ410が、ダイナミックリンカ450を呼び出し、アプリケーション100のロードモジュール110に対してダイナミックリンクライブラリ600をダイナミックリンクする。このダイナミックリンクにより、ダイナミックリンクライブラリ600中の大域変数の参照、大域変数化された静的変数の参照ができるようになる。   In step 43, the internal debugger 410 calls the dynamic linker 450 to dynamically link the dynamic link library 600 to the load module 110 of the application 100. By this dynamic linking, it is possible to refer to global variables in the dynamic link library 600 and to refer to static variables that have been globalized.

ステップ44では、内部デバッガ410が、実行中のアプリケーション100に含まれる手続きについて、パッチであるダイナミックリンクライブラリ600に含まれている大域手続きが実行されるように変更する。具体的には、内部デバッガ410は、実行中のアプリケーション100の手続きを、ダイナミックリンクライブラリ600の大域手続きにブランチするように変更する。これにより、ダイナミックリンクライブラリ600において定義されている大域手続きの参照が可能となる。   In step 44, the internal debugger 410 changes the procedure included in the application 100 being executed so that the global procedure included in the dynamic link library 600 as a patch is executed. Specifically, the internal debugger 410 changes the procedure of the application 100 being executed to branch to the global procedure of the dynamic link library 600. Thereby, the global procedure defined in the dynamic link library 600 can be referred to.

かかるデバッガによれば、実行中のアプリケーション100を一時停止した状態で、アプリケーション100のバグを解消するためにソースコード500を修正すると、修正したソースコード500から、アプリケーション100にダイナミックリンク可能なダイナミックリンクライブラリ600が生成される。このとき、修正したソースコード500について、局所的な静的変数がユニークな名称の大域変数に置き換えられると共に、大域手続きがユニークな名称の手続きに書き換えられて、ダイナミックリンクライブラリ600が生成される。   According to such a debugger, when the source code 500 is corrected in order to solve the bug of the application 100 in a state where the application 100 being executed is temporarily stopped, the dynamic link that can be dynamically linked from the corrected source code 500 to the application 100 is possible. A library 600 is generated. At this time, in the modified source code 500, a local static variable is replaced with a global variable with a unique name, and the global procedure is rewritten with a procedure with a unique name, so that the dynamic link library 600 is generated.

また、生成されたダイナミックリンクライブラリ600が、次のようにして、実行中のアプリケーション100に適用される。即ち、大域変数化された静的変数の実アドレスと大域変数とを関連付けて、ダイナミックリンカ450を呼び出すことで、大域変数が静的変数の値を継承できるようにする。さらに、実行中のアプリケーション100の手続きについて、ダイナミックリンクライブラリ600の大域手続きが実行されるように変更することで、アプリケーション100の手続きに代えて、ダイナミックリンクライブラリ600の大域的手続きが実行されるようにする。   Further, the generated dynamic link library 600 is applied to the application 100 being executed as follows. That is, by associating the real address of the static variable converted to the global variable with the global variable and calling the dynamic linker 450, the global variable can inherit the value of the static variable. Furthermore, by changing the procedure of the application 100 being executed so that the global procedure of the dynamic link library 600 is executed, the global procedure of the dynamic link library 600 is executed instead of the procedure of the application 100. To.

ここで、大域変数が静的変数の値を継承できる仕組みについて説明する。図5に示すソースコード500について、静的変数Xの実アドレスが、“XXXX”であると仮定する。このソースコード500における静的変数Xを大域変数化することで、図10に示すように、静的変数Xは大域変数X_001となる。そして、静的変数Xについて、その実アドレスXXXXと大域変数X_001とが関連付けられているので、大域変数X_001を参照することは、アドレスXXXXを参照することと同一となる。アドレスXXXXは静的変数Xの実アドレスであるため、大域変数X_001を参照することは、静的変数Xを参照することとなり、静的変数Xの値を継承することができる。   Here, the mechanism by which a global variable can inherit the value of a static variable will be described. For the source code 500 shown in FIG. 5, it is assumed that the real address of the static variable X is “XXXX”. By making the static variable X in the source code 500 a global variable, the static variable X becomes a global variable X_001 as shown in FIG. Since the real address XXXX and the global variable X_001 are associated with the static variable X, referring to the global variable X_001 is the same as referring to the address XXXX. Since the address XXXX is the real address of the static variable X, referring to the global variable X_001 refers to the static variable X, and the value of the static variable X can be inherited.

そして、一時停止していたアプリケーション100の実行を再開すると、ダイナミックリンクライブラリ600の手続きが実行されるようにアプリケーション100が変更されているため、修正したソースコード500により規定した手続きが実行されることとなる。このため、動的なアプリケーションの修正を実現することができる。   Then, when the execution of the application 100 that has been suspended is resumed, the application 100 is changed so that the procedure of the dynamic link library 600 is executed. Therefore, the procedure specified by the modified source code 500 is executed. It becomes. Therefore, dynamic application correction can be realized.

従って、アプリケーションの動的な修正において、静的変数の値を継承することができるようになる。
なお、本実施形態は、ホストコンピュータ200と少なくとも1台の利用者端末300とを有するコンピュータシステムに限らず、PC(Personal Computer)、WS(Work Station)などのコンピュータシステムにも適用可能である。また、高級言語としては、C言語に限らず、静的変数、大域変数などを扱うことができる、C++言語、FORTRAN言語などにも適用可能である。
Therefore, the value of the static variable can be inherited in the dynamic modification of the application.
The present embodiment is not limited to a computer system having the host computer 200 and at least one user terminal 300, but can be applied to a computer system such as a PC (Personal Computer) or WS (Work Station). Further, the high-level language is not limited to the C language, and can be applied to a C ++ language, a FORTRAN language, or the like that can handle static variables, global variables, and the like.

100 アプリケーション
200 ホストコンピュータ
300 利用者端末
400 統合開発環境
410 内部デバッガ
420 外部デバッガ
430 デバッガ制御装置
440 ビルダ・コンパイラ
450 ダイナミックリンカ
500 ソースコード
600 ダイナミックリンクライブラリ
DESCRIPTION OF SYMBOLS 100 Application 200 Host computer 300 User terminal 400 Integrated development environment 410 Internal debugger 420 External debugger 430 Debugger controller 440 Builder compiler 450 Dynamic linker 500 Source code 600 Dynamic link library

Claims (5)

コンピュータに、
アプリケーションプログラムの一部分に対応するソースコードを修正して得られるソースコードに含まれる、関数内にネストされた静的変数を含む局所的な静的変数を、大域変数に変更し、
前記アプリケーションプログラムの処理により前記静的変数の変数値が格納されたアドレスと、前記大域変数と、を関連付けて記憶手段に記憶し、
前記アプリケーションプログラムの処理において前記アプリケーションプログラムの前記一部分が呼び出された場合に、前記静的変数を前記大域変数に置き換えて得られるソースコードをコンパイルして得られるプログラムが実行されるように設定し、
前記アプリケーションプログラムの処理において前記大域変数が呼び出された場合に、前記大域変数と関連付けられて前記記憶手段に記憶された前記アドレスから変数値が読み出されるように設定する、
処理を実行させることを特徴とするデバッグ支援プログラム。
On the computer,
Change local static variables, including static variables nested in functions , included in the source code obtained by modifying the source code corresponding to a part of the application program to global variables.
An address where the variable value of the static variable is stored by the processing of the application program and the global variable are associated and stored in the storage means,
When the part of the application program is called in the processing of the application program, the program obtained by compiling the source code obtained by replacing the static variable with the global variable is set to be executed,
When the global variable is called in the processing of the application program, the variable value is set to be read from the address stored in the storage means in association with the global variable.
A debugging support program characterized by causing processing to be executed.
前記大域変数は、ユニークな名称が付される、
ことを特徴とする請求項1に記載のデバッグ支援プログラム。
The global variable is given a unique name,
The debugging support program according to claim 1, wherein:
前記一部分に対応するソースコードを修正する処理は、前記ソースコードにおける手続きの名称をユニークな名称に変更する処理であり、
前記設定する処理は、前記ソースコードにおける前記手続きが呼び出された場合に、前記ユニークな名称の手続きにブランチさせる設定を行う処理を含む、
ことを特徴とする請求項1又は請求項2に記載のデバッグ支援プログラム。
The process of correcting the source code corresponding to the part is a process of changing the name of the procedure in the source code to a unique name.
The setting process includes a process of setting to branch to the unique name procedure when the procedure in the source code is called.
The debugging support program according to claim 1 or 2, characterized by the above-mentioned.
コンピュータが、
アプリケーションプログラムの一部分に対応するソースコードを修正して得られるソースコードに含まれる、関数内にネストされた静的変数を含む局所的な静的変数を、大域変数に変更し、
前記アプリケーションプログラムの処理により前記静的変数の変数値が格納されたアドレスと、前記大域変数と、を関連付けて記憶手段に記憶し、
前記アプリケーションプログラムの処理において前記アプリケーションプログラムの前記一部分が呼び出された場合に、前記静的変数を前記大域変数に置き換えて得られるソースコードをコンパイルして得られるプログラムが実行されるように設定し、
前記アプリケーションプログラムの処理において前記大域変数が呼び出された場合に、前記大域変数と関連付けられて前記記憶手段に記憶された前記アドレスから変数値が読み出されるように設定する、
処理を実行することを特徴とするデバッグ方法。
Computer
Change local static variables, including static variables nested in functions , included in the source code obtained by modifying the source code corresponding to a part of the application program to global variables.
An address where the variable value of the static variable is stored by the processing of the application program and the global variable are associated and stored in the storage means,
When the part of the application program is called in the processing of the application program, the program obtained by compiling the source code obtained by replacing the static variable with the global variable is set to be executed,
When the global variable is called in the processing of the application program, the variable value is set to be read from the address stored in the storage means in association with the global variable.
A debugging method characterized by executing processing.
第1の装置と、アプリケーションプログラムを実行する第2の装置と、を含むデバッグ支援システムであって、
前記第1の装置が、
前記アプリケーションプログラムのうちの一部のプログラムに対応するソースコードを修正して得られるソースコードに含まれる、関数内にネストされた静的変数を含む局所的な静的変数を、大域変数に変更する変更手段と、
変更後のソースコードをコンパイルして得られる修正プログラムを、前記第2の装置に送信する送信手段と、を含み、
前記第2の装置が、
前記アプリケーションプログラムの処理により前記静的変数が格納されたアドレスと、前記大域変数と、を関連付ける関連付け手段と、
前記アプリケーションプログラムの処理において前記一部のプログラムが呼び出された場合に、前記静的変数を前記大域変数に置き換えた前記修正プログラムが実行されるように設定する設定手段と、を含む、
ことを特徴とするデバッグ支援システム。
A debugging support system including a first device and a second device that executes an application program,
The first device comprises:
Change local static variables, including static variables nested in functions, in the source code obtained by modifying the source code corresponding to some of the application programs to global variables Change means to
Transmission means for transmitting a correction program obtained by compiling the changed source code to the second device,
The second device comprises:
Association means for associating the global variable with the address where the static variable is stored by the processing of the application program;
Setting means for setting the correction program in which the static variable is replaced with the global variable to be executed when the part of the program is called in the processing of the application program;
This is a debugging support system.
JP2011179836A 2011-08-19 2011-08-19 Debug support program, debug support method, and debug support system Active JP5906609B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011179836A JP5906609B2 (en) 2011-08-19 2011-08-19 Debug support program, debug support method, and debug support system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011179836A JP5906609B2 (en) 2011-08-19 2011-08-19 Debug support program, debug support method, and debug support system

Publications (2)

Publication Number Publication Date
JP2013041546A JP2013041546A (en) 2013-02-28
JP5906609B2 true JP5906609B2 (en) 2016-04-20

Family

ID=47889851

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011179836A Active JP5906609B2 (en) 2011-08-19 2011-08-19 Debug support program, debug support method, and debug support system

Country Status (1)

Country Link
JP (1) JP5906609B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107391191B (en) * 2017-07-18 2020-10-13 杭州中天微系统有限公司 Dynamic loading method for program module
CN107391190B (en) * 2017-07-18 2020-10-13 杭州中天微系统有限公司 Dynamic loading method for program module
CN110275722B (en) * 2019-06-21 2023-08-08 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for upgrading application

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5675803A (en) * 1994-01-28 1997-10-07 Sun Microsystems, Inc. Method and apparatus for a fast debugger fix and continue operation
JPH10228371A (en) * 1997-02-14 1998-08-25 Matsushita Electric Works Ltd Program development system for picture processing inspection device
JP2004287858A (en) * 2003-03-24 2004-10-14 Matsushita Electric Ind Co Ltd Program test device
JP5067705B2 (en) * 2007-03-22 2012-11-07 日本電気株式会社 Abnormal test support device, abnormal test support method, and program

Also Published As

Publication number Publication date
JP2013041546A (en) 2013-02-28

Similar Documents

Publication Publication Date Title
US8499289B2 (en) Method, device and system for realizing kernel online patching
US8762971B2 (en) Servicing a production program in an integrated development environment
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
EP1743243A2 (en) Apparatus and method for improving emulation speed of high-level languages in on-chip emulation systems
CN102402427A (en) Method and device for updating Java application program
US10248409B1 (en) Limiting the effects of source code patches on corresponding native-code patches
US20180203676A1 (en) Removing library objects from a static library
CN104866293A (en) Method and device for extending Android application program function
JP5906609B2 (en) Debug support program, debug support method, and debug support system
US20080127118A1 (en) Method and system for dynamic patching of software
US20110029953A1 (en) System and Method for Scalable Handling of Debug Information
CN103645888A (en) System and method for automatically building operation system
JP2008198060A (en) Information processor, patch code mounting system, electronic equipment, and patch code mounting method
CN111930398B (en) Application program updating method, device, system, medium and equipment
US8276132B1 (en) System and method for representing and managing a multi-architecture co-processor application program
KR20050028465A (en) Mcu application program verification system providing source code level debugging using debugging information files in different versions and method thereof
JP6318214B2 (en) PLC debugging method using a general-purpose microprocessor
CN113342323A (en) Method and device for software online development
CN113157329A (en) Method, system, server and storage medium for starting application
US8347310B1 (en) System and method for representing and managing a multi-architecure co-processor application program
US8281294B1 (en) System and method for representing and managing a multi-architecture co-processor application program
JP6295914B2 (en) Programmable controller system, its support device, programmable controller
JP2011090511A (en) Execution program, compiler, and device and method of correcting execution program operation
TW201316255A (en) Automatic compilation method and system
CN110968494A (en) Software debugging method and device and computer storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140508

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20140514

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20141224

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150120

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150312

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150825

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20151020

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20160223

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160307

R150 Certificate of patent or registration of utility model

Ref document number: 5906609

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150