Vladimir Prus


vladimirprus.com

Thursday, April 06, 2006

Printf debugging 2006

One of the oldest methods of debugging is "printf debugging" -- putting various print statements in the code and then staring at the output. That's useful not only if you can't use a debugger. If the program does not crash, but produces wrong results after long computation, it's hard to figure where exactly the problem lies. In that case, printing intermediate data can be a very efficient method.

The only problem is that after adding print statements the program must be recompiled, and after debugging print statements must be removed. But it's possible to make gdb into printing machine using so called "breakpoint commands". Each breakpoint can have a list of commands that will be executed when breakpoint is hit. The commands can include printing and "continue". Here's a simplified example of gdb script I've used recently:

break main.cpp:1353
commands
   print ('lvk::nm_model::NM'*)this
   printf "Entering 'run', proc %d\n", $->processor_number
   continue
end
run

After putting this to a file "script", gdb can be run as:

gdb -batch -x script name_of_program > log
producing logs of variable values as certain points of the program.

Starting with version 3.3.0, similar functionality is available in KDevelop. Just click on the "Tracing" column in breakpoints window, select variables to print and click OK.

More screenshots here and here. This is a beginning, future KDevelop version will allow to specify custom commands for breakpoints.

444 comments:

«Oldest   ‹Older   401 – 444 of 444
jackwilson said...

Physics is not an easy subject but with Civil Engineering Online Exam Help, you surely are going to love it! We have trained our experts to make the Online Exam Help a fun program for the students. If you are looking for Electrical Engineering Online Exam Help, we are the right place.

Omsdelhi said...

Super Zhewitra Tablet, one of the most effective generic medications exported and supplied by our company, is made up of Vardenafil 20 mg and Dapoxetine 60 mg for immediate results. Super Zhewitra Pills come in a compact blister pack of four moisture-resistant tablets. Omsdelhi provides the online delivery of the drug.

Garcia said...

Academic-Answers.net is a professional academic writing service dedicated to assist our clients achieve scholarly excellence. Our agency has a reputation of a trustworthy and caring writing service not only among customers but also among academic writers. Get AcademicAnswers

Jack said...

I am living abroad and I was wondering if you provided online economics homework help internationally. My brother is also in need of your services so I need to know the details accordingly. I hope that your services are not very pricey as that will be a problem on your end. Microeconomics homework help and Stata homework help from your stop is also going to help us enormously so please let us know about it. We are waiting for your immediate response. Thank you.

Unknown said...

This Bike rental in Bhubaneswar has become the first choice for the middle-income bracket as it is very convenient and keeps you stress-free. People who want to escape the paperwork of buying a car, instantly opt for a self drive cars in Bhubaneswar and Car rental in Cuttack which is equally reliable as your car.

james said...

The team behind our awesome assignment help USA service maintains strict policies against plagiarism. Collaborating with our writers by availing Assignment Help in United States will not only help you with your grades but also your essay assignment skill will be good.

Evajames said...

Programming Assignment Help expert includes a team with expertise and knowledge in educational projects. Our team has professionals with relevant trade experience, who are focused on helping students with their school assignment. Our skilled writers forever add set with the requirements given to us, and this makes our assignment solution a perfect one.

Unknown said...

Are you searching for CIPD assignment writing help? Most likely, you will need to acquire the homework assist services of CIPD experts. In most scenarios, CIPD assignments tend to revolve around human resource management or HR development. This does not go to mean that the jobs will be as easy as ABC. Read more CIPD Level 3 Assignment Examples

Unknown said...

Independent of the work you put in to get a distinctive thought, you are probably going to confront challenges while drafting a task. May you are looking for a decent essayist for college task help. For more data visit edit my essay now! You can likewise get in touch with us, our help is live every minute of every day for better help.

Services:

Pay Someone To Do My Homework

ENGL V01A assessment answers

FELM4026 assessment answers

LS311-5 assessment answers

BUS303 assessment answers

Anonymous said...

Hi, your blog is truly faultless and unique. Wonderful contents, this is the best article i read with more information than any other blog zone. I liked it. Thank you so much for sharing this article with us. visit more info Math Homework Help and Assignment maker

zarkazijar said...

The blog is well organized with content as per readers interest, very clear description of terms and valuable source of data, looking forward for more of your useful updates, thanks for sharing. wellspring university cut off mark for industrial chemistry

Daisy Lilly said...

Now, this is what I call a great read. I loved how you presented the need for professional Assignment Help Australia services among students in today's competitive scenario. If you belong to the same lot you should definitely try out the My Assignment Help facility offered by the diligent experts of the MyAssignmentHelpsAu platform. The highly qualified panel works day in and day out dedicatedly to produce 100% original and legitimate assignment outcomes for students pursuing their education in any nook and cranny of the world.

cipd said...

Do you enjoy soaking in the tub or taking a long bath? You may have trouble fitting in it due to the small Bathtub. Does it ever get uncomfortable to use it? Well, we’ve got the best solution available for you. You should not be concerned about someone at home being tall and unable to use the Bathtub to relax. Tall people can find relaxing in a rather congested bathtub very uncomfortable. Read more about Bathtub for Tall People

Electromart said...

Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. If you looking for best Electronic Online shop ,Electromart is the best choice for you, After all I’ll be subscribing to your feed and I hope you write again soon!

Polytanksafrica said...

Awesome informations i found in this article, exactly what i want, thank you so much for this awesome informations and if you also, interested to know about polytanksafrica then click this.

Big Save Furniture said...

The blog written is extremely impressive, with a great topic. However, a bit more research could have strengthened it even further. You can explore the services as offered by Big Save Furniture, a quality services platform offering the best of furniture services teamed with knowledge and experience.

Toys Direct said...

Good blog. Keep sharing. I love it are you also searching for children toys? Toys Direct is the best solution for you. We are best known for selling best toys to clients in Kenya.

BabyBanda said...

The blog is very informative around the world many people want to read these type of post i am also involved in this crowd though i am a business lady. You can visit BabyBanda to see the baby products we sell and also pregnant mothers products, I also want to read these type of posts.

Furniture Palace said...

Wow this is a very interesting blog, Here at Furniture Palace we sell quality wooden products at customer friendly prices. Buy with us today and enjoy quality products, long lasting.

Silverstone said...

Get the best deals , prices and, discounts on tires at Silverstone from major tire brands. We have fast & free shipping and easy 45 days return policy.

PerfumeUAE said...

Your post has opened my eyes. If you want the best perfume sellers in the GCC countries,PerfumeUAE is the best option for you. best selling perfumes, fragrances, colognes and after shaves. If you are having trouble deciding what perfume or cologne to buy then you have come to the right place. Our best selling fragrance selection is generated directly from customers orders. If you are trying to figure out what’s trending now and popular then this is the best place to browse.

Nursing Writing Service said...

Nice blog, are you looking for best nursing writing help, here at Nursing Writing Service we offer the best writing services. Our papers are plagiarism free and we follow all the requirements, Make an order with us today.

Celebrity said...

Attractive information on your blog, thank you for taking the time and share with us. Amazing insight you have on this, it’s nice to find a website the details so much information about different artists .Net worth

Celebrity said...

Your information is very detailed and useful to me, thank you for sharing. I hope you will always be up to date. know about Net worth

Kelvin said...

Our team of experts will help you in writing CIPD Level 5 assignments which is among the most taken CIPD Module in the world.

Eliana Grace said...

The native starches market is segmented on the basis of source, type, application, and geography. Native starch is a powder-like substance obtained from plants that contain starch. Native starch is a pure form of starch, without any chemical additives. In chemical terms, it is long-chain carbohydrates joined together by glycosidic bonds called polysaccharides. The starch can be obtained from different sources such as corn, wheat, rice, potato, and cassava. This is used in a wide range of food products to enhance the texture, control the moisture, stabilize, thickening agent, dough binding agent, and others.

Eliana Grace said...

The global naphtha market size was 270.7 million tons in 2014 and is anticipated to grow at a CAGR of 3.4% from 2015 to 2022. Increasing global demand for transportation fuel is expected to drive growth. Demand is also being driven by its robust use for the hydrocarbon cracking process in the petrochemical industry. Naphtha is an essential part of the hydrocarbon cracking process, which is conducted under extreme pressure and heat, as it exhibits superior heat-resistant properties. Various environmental regulations and region-dependent pricing also make the choice for usage of naphtha materials in the production process. The global demand is estimated to be worth USD 183.38 billion by 2022.

Unknown said...

I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.
파워볼분석

Unknown said...

This type of article that enlighted me all throughout and thanks for this.This going to be excitement and have fun to read. thank to it. check this out to for further exciting.
바카라

Celebrity said...

Your blog has amazing and unique information thanks for sharing.net worth

Garcia said...

The CIPD Level 3 is designed to help you strengthen your professional capabilities in people practice. Besides, it is a foundation level qualification for CIPD levels 5 and 7. This CIPD level is designed to equip learners with practical and theoretical skills across the core functions of people practice. Read More CIPD Level 3 Assignment Help

Celebrity said...

Awesome, This one look this post and say only wow... becasue you have to share great and creative ideas amd I hope this will be very helpful for everyone specially for me.Net worth

Celebrity said...

Thank you for posting such a great blog! I found your website perfect for my needs. It contains wonderful and helpful posts. Keep up the good work. Thank you for this wonderful Blog!Net worth

onlineAssignmenthelp said...

You can contact our CDR report writers for clarification if you are unsure about the details of your CDR report, or are not sure where to apply, or your submitted CDR report Afraid to send. The CDR report you create can also be updated and revised, and a better copy is sent directly to you by our CDR report writers.
https://www.thetutorshelp.com/cdr-report-help.php
CDR Report Help

Gaurish Technologies Pvt. Ltd. said...

Your Content is amazing and I am glad to read them. Thanks for sharing the Blog.this blog is very helpful information for every one.

Website Development Company in Gwalior

Web Development Company in Gwalior

Marriage Garden in Gwalior

Facebook Discontinued Marketplace Vehicle Listings? How Can We Help?

New and Used Cars for Sale in USA

Lubbock moving company

Online Auto Auctions for Car Dealers

Best CRO and Top CMO Company in New Jersey USA

Arif said...

Statistics is one of the most complicated branches of mathematics. However, due to the high demand for statisticians, many students pursue studies in statistics. As a result, they are dealing with statistics problems. Due to this, statistics assignment help has become increasingly popular. Because we have experienced statisticians, we are the best for the same. You can easily find simple, easy-to-understand solutions to the statistics problems with our help. Read more on Statistics Assignment Help

Celebrity said...

Thank you for bestowing this information which will enlighten many of us. It’s really helpful who wants to know more about.Net worth

Academic Writers Center said...

Get Custom Assignment Help from Professionals. My Assignment Help, has a dedicated team of academic experts who are capable to provide the best advice for your assignment help, , who have many years of experience of practice.

Anonymous said...

Excellent. Good blog. Keep sharing. I love them Are you also searching for order assignment online? we are the best solution for you. We are best known for delivering book review writing services to students without having to break the bank

Unknown said...

I love this. It is soo informative. Are you also searching for swedish assignment writers we are the best solution for you. We are best known for delivering the best services to students without having to break the bank

IIM Udaipur said...

IIM Udaipur is one of only four IIMs and a total of 30 Indian best B-schools to follow the Indian Placement Reporting Standards (IPRS).

dnp said...

Generally, a capstone project offers one a chance to utilize the knowledge learned and skills gained. A Doctor of Nursing Practice (DNP) is a terminal degree in nursing. In order for you to graduate with this degree, you need to prove that you possess the requisite skills. Read more from DNP Capstone Project Writing Services

Unknown said...

With innovation and the world of work changing really fast, the future is bound to raise new problems as well as new opportunities. For these reasons, CIPD launched a new Professional Map which provides a stronger foundation that gives professionals more confidence and capacities to not only guide their professional decision making but also their behaviours and actions. The new 2021 CIPD qualifications are the core of the Professional Map. Read more about CIPD Levels and Qualifications

Ian said...
This comment has been removed by the author.
«Oldest ‹Older   401 – 444 of 444   Newer› Newest»