Debugging scripts will help you to use the debugger more efficiently

Source: Internet
Author: User
Tags continue dbx requires

When we debug a more complex problem, it is difficult to locate the problem, you need to try to set breakpoints, multiple continue, view variable values, and so on, sometimes need to set some special debugging variables and so on. This process often requires you to restart the debugger several times and restart these debugging commands. If debugging does not support reverse debugging, or if the reverse debugging performance is poor, the use of history and debug scripts simplifies this process, with ZOS USS DBX as an example, let's take a look at how to use it. At the same time, such debugging scripts will have references that will become their own or other first-use DBX users.

When we debug a more complex problem, it may be difficult to locate, you need to try to set breakpoints many times, multiple continue, view variable values, and so on. Sometimes, you also need to set some special debugging variables. This process often requires restarting the debugger multiple times, and executing these debugging commands over and over again. At this point, if the debugger does not support reverse debugging, or reverse debugging performance is poor, the above process reduced to a series of tedious, repetitive operation. Hand acid, knock tired, circle it, here to introduce a use of history and debugging scripts to cooperate with each other to liberate our poor hands and brain. Taking ZOS USS DBX For example, let's take a look at how our operations can be simplified. At the same time, this method is useful for similar debugging work in the future or for the users who first use DBX.

1. We use the DBX debugging main program As an example, the following is a debugging process, during which we set breakpoints and debugging variables. At the end of the debugging, we use the history command to get all the executed DBX subcommands. Note that the yellow part is the DBX subcommand I typed for the debugger, and the other part is DBX output.

DBX Main

/u/chenxl/example-dbx >> dbx main # start DBX debug Main

(dbx64) Stop in main # set a breakpoint at main ()

[1] stop in ' int main (int argc, unsigned char **argv) '

(dbx64) Set $listwindow = 20 # To change the default display row Number 10 to 20

(dbx64) Set $repeat # setting Repeat,enter, the last DBX will be repeated subcommand

(dbx64) Set $catchbp = 1 # Executes the Next/step procedure and, if a breakpoint is encountered, triggers the breakpoint and stops

(dbx64) Run # Set the debug variables, let's go

[1] stopped in main at line in file "Main.c" ($t 2)

int main (int argc, char *argv[])

(dbx64) List # shows 20 lines of source code

17 {

volatile int ti = 0;

19

if (argc > 2) {

x = Atoi (argv[1]);

if (argc > 3) {

y= atoi (argv [2]);

24}

25}

26

TI = BBB ();

for (ti = 0; ti < ti++) {

AAA ();

30}

if (x = = 4) {

y = BBB ();

33}

Or else {

y = CCC (x,y);

36}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.