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.

71 comments:

Anonymous said...

Wow, never know about this useful trick.

Anonymous said...

Nice, but why do you use pixelated (non anti-aliased) fonts? It makes the writing look like it's in the stone age :)

Unknown said...

Heh, I can't control which fonts are antialised on your machine ;-)

Anonymous said...

Nice, but why do you use pixelated (non anti-aliased) fonts? It makes the writing look like it's in the stone age :)
I thought all developers preferred to avoid headache inducing blurry fonts when doing serious coding.

jospoortvliet said...

> I thought all developers
> preferred to avoid headache
> inducing blurry fonts when doing
> serious coding.

depends on the way you anti-alias your fonts... there are ways to keep em clear and actually make em more readable.

Anonymous said...

Anonymous said...

> Nice, but why do you use
>pixelated (non anti-aliased) fonts?
>It makes the writing look like it's
>in the stone age :)

I always wonder why people look at things totally out of the topic of blog post while commenting. Its really hard for developers to blog(most of them aren't professional bloggers) keeping all these extra stuff in mind :) Thank god, atleast you weren't rude :)

Anyway this is really nice useful trick. Thanks for this tip :)
--
gopala

Nathan William said...

Engineers who wish to migrate to Australia must submit a Competency Demonstration Report and the Engineers Australia must approve it. Thus, engineering students look forward to getting
Cdr Australia which assists them to get a flawless CDR. This reduces the chances of rejection by the EA.
Most students and experienced civil engineers are today looking forward to migrating to Australia as the job scope is better and bigger with a high pay scale. Therefore, getting CDR help is the only scope to gain entry into the country.
The CDR for Engineers Australia must be impressive and abide by the ANZSCO code and guidelines. It should also showcase the skills of the applicants as a suitable civil engineer to work according to the Australian rules and regulations.
The service providers who assist the students with CDR have experienced CDR report writing. These writers know the requirements of a CDR and do it accordingly.

rickypauls said...

Great post with informative details of Assignment Help. For effective help to complete your project related to any subject, visit greatassignmenthelp or opt for live chat option.
Assignment Help Online
Online Assignment Help
Assignment Help Online Services
Assignment Helper
Assignment Assistance
Assignment Help Experts
Online Assignment Help Services
Assignment Writing Help

Michael Jones said...

It is not easy for many students to do assignments on their own as it requires a lot of research and time for making assignments. That is why; they take help from Online Assignment help.Java Assignment help

Max Willor said...

I suggest everyone to choose Assignment Help Australia for getting the best guidance in their academia. The proficient experts assist as per the requirements and learning styles desired by the university.

Olivia Crew said...

Livewebtutors aims at providing the students with a one stop solution for all the academic related issues. The company has Livewebtutors is an online Assignment Help and assignment writing service offering expert assignment help. Hire Australian assignment writing experts.
visit now:- Assignment Help

Olivia Crew said...

Livewebtutors aims at providing the students with a one stop solution for all the academic related issues. The company has Livewebtutors is an online Assignment Help and assignment writing service offering expert assignment help. Hire Australian assignment writing experts.
visit now:- Nursing Assignment Help

idealassignmenthelp said...

A very high level post with a knowledgeable information .thanks you for giving me such a nice information. If you need any college level
My Assignment Help at reliable quality with better work. Kindly visit Ideal assignment help.

Bella said...

Your Blog is appriciatable.
Paperssolution
topacademictutors
liveassignmenthelp

darylharper said...

Make your Travel smarter Cash Back offers and make your Online Credit Card Payment using your account with any other bank.

printersupportnumber said...

Nice Post..
Is your HP printer getting offline all of sudden while printing? Because of this issue, are you unable to print any document or file? Want an instant support from top-most technicians to bring it online from offline? If really so, then place a single call at HP Printer Support Phone Number where you will receive the exact possible answer of your offline printer related query. Our technical engineers are talented and knowledgeable in technical field. So, you will be proffered handy remedy within a minute.

Olivia Crew said...

A very high level post with a knowledgeable information .thanks you for giving me such a nice information. If you need any college level Assignment Help at reliable quality with better work. Kindly visit livewebtutors website we providing best assignment help services in
Australia, USA, UK, UAE, and Canada etc.
Read more now :- Assignment Help Australia

Anonymous said...

Having an HP printer driver on operating system is very important for starting a print job. Your printer won’t be worthy until you download and install the correct driver for your HP printer. Therefore, in case you don’t know the steps of printer driver installation, you can simply open your web browser and enter the URL 123.hp.com onto the search bar. The entire downloading procedure will be come up in front of you and once you go through those steps, printer driver will surely be installed on PC. But if facing some complications while following the given points, you can give an instant ring at XYZ. Your problem will be sorted out within a pinch by our technical team.

john amber said...

I suggest all members choose assignment help Australia for the best guideline in your academia. The perfect and expert assistant your requirement and learning assignment project by the university.

Olivia Crew said...

Excellent information Providing by your Article, thank you for taking the time to share with us such a nice article. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Kindly visit livewebtutors website we providing best assignment help services in Australia.
Read more now :- Business Assignment Help

Smith John Live said...

For HP Officejet Pro 9015 setup and troubleshooting assistance, visit 123.hp.com/setup 9015

Alex williams said...

Do you require HP printer setup for your mac operating system? Is your printer driver not suitable for macOS? Then visit the 123.hp.com to get the software and driver for better functioning of your printer. You can also call our expert HP support team for services.

john amber said...

Everything should be based on fact. The arrangement of fact and information is not an easy task sometimes it becomes a very tough task to do in such cases student can go through online Assignment Help , and these services are very reliable, and they can provide information about any topic related to the academics. If you need any college level Assignment Help at reliable quality with better work. Kindly visit our website.

Microsoft Outlook Office said...

We recently did work on Hotmail. We have Change Hotmail Password after that, assess Hotmail is very easy for work for everyone. With our client request, we are worked on it and finally, we got success to hotmail change password.
Is there a phone number for Hotmail support?
change microsoft password
How do I call Outlook support?
How do I contact outlook customer service?
How Can I Contact Outlook Support?
How do I Contact Outlook Support?
Is there a phone number for Outlook support?
Is there a Phone Number for Office 365 Support?
Is there a phone number for Microsoft office support?
outlook keeps asking for password
Outlook Working Offline

Microsoft Support said...

The mentioned points in this guide are very informative and helped me to resolve my issue in a very proficient manner. At the time of solving my query I got stuck at one point, so I called at outlook Support Phone number and the technician who answered my call guided me thoroughly to get rid of my issue. I really appreciate the hardworking of that guy, who helped me during my crisis of time and never leave my side until problem didn’t get resolved. Therefore, I personally suggest everyone to get hold of Microsoft outlook Support if you really want to resolve your query related to your Outlook.
How do I call Outlook support?
Is there a phone number for Outlook support?
How do I contact Hotmail Support?
Is there a phone number for Hotmail support?
Change Hotmail Password
hotmail change password
change microsoft password
Is There A Phone Number For Microsoft Windows Support?
How Do I Contact Microsoft Windows Support?
How to Contact Microsoft Windows Tech Support?
Windows support
Microsoft windows support

Manndy said...

Air India, Ordinance and now Honda Motors Sinking Economy hits Honda’s Temp Workers, Manesar, 16% laid-off (57.53% remaining), 30.95% speculated, 73.53% Third Party Pay-Roll bread in-secure. more

Alex Jones said...

Get the compatible software by navigating to the 123.hp.com/setup web page!

walker phoenix said...

Are you searching for a model that can offer excellent print speed and quality? It's the Kodak Verite 55 that is in more demand. The top features include attractive design, print speed for 10 ppm for black and 4ppm for color, affordable print cost and lot more. Download the device setup manual to execute the setup. For guidance reach out to our techies who can guide you round the clock

john amber said...

Thank you for this wonderful information looking forward for more. We are Providing the best quality assignment help. You will find out online My Assignment Help service on firstassignmenthelp. And these services are very reliable, and they can provide information about any topic related to the academics. If you need any college level Assignment Help at reliable quality with better work. Kindly visit our website firstassignmenthelp.

john amber said...

Hello… Interesting blog, this blog is very nice and good knowledge. If you are looking for the assignment help and my assignment help service provider then you should definitely go for FirstAssignmentHelp.

Ronaldo drogba said...

Do you want to activate your Roku? The first and the primary step involved in Roku activation is Roku Account Setup. You need a valid Roku com link account in order to setup your Roku. Visit Roku.com/link website to know how to create Roku account. Ring @ +1-844-839-1180 toll-free number and get the best Roku customer support.

Health Tips said...

csv to vcf online

Jason Mathew said...

When it comes to streaming, I have explored a lot of devices. But I have never come across a product like Roku. It is fabulous and more dynamic in design. The shape resembles a Pen drive yet it could bring you loads of Entertainment. The features of the Roku player are pretty decent and especially the enhanced voice search is what impressed me the most. Visit Roku.com/link website to know more.

Informative said...

You can buy moisture meter from here, that can be operates is based upon the meter type.https://hvactools.splashthat.com/

Tillock Watson said...

'I'm highly impressed by the piece of thoughts you have shared on this portal. all the best
connect us on Assignment Help can shed your burden of assignments with a return of qualitative assignments.

john amber said...

Thank you for this wonderful information looking forward for more. We are Providing the best quality assignment help. You will find out online My Assignment Help service on firstassignmenthelp. And these services are very reliable, and they can provide information about any topic related to the academics. If you need any college level Assignment Help at reliable quality with better work. Kindly visit our website firstassignmenthelp.

Leo5 said...

Finally a yummy looking recipe that even I could make! Looks delicious.
How To Root Any Android Device

UK Dissertation Help said...

Hello, I am here to tell about new topic, which is really serious information to know. There are many who considers Essay Writing services and Dissertation Writing services to be the same. No, they aren’t! To make it easy for you, we will help you understand the difference between what’s the difference between dissertation and essay assignments!

Max Willor said...

Very Nice Blog! This Blog is Totally Informative About Assignment Help Melbourne In Australia. If You Are Looking For Assignment Help Melbourne Provider Then You Should Definitely Go For Myassignmenthelpau.

belly sons said...

i-LEND is an online marketplace connecting borrowers and lenders for loans. Although i-LEND verifies credentials of registered users on the site, it does not guarantee any loan offers by lenders nor does it guarantee any repayments by borrowers. Users make offers/loan requests at their own discretion with the understanding of the risks involved in such transactions including loss of entire capital and/or no guarantee of recovery. Please read our Legal agreements to understand more.https://www.i-lend.in/

greyhankin said...

It’s not a tough task to activate Roku. Understand the Roku activation steps. Connect the necessary hardware. It's the power and HDMI, USB cable that is required. Sign in to Roku account and move to the page Roku.com/link. To begin streaming, visit the channel store and start the channel search. Select and then add the channel to proceed. Want to know How to Activate Roku? Use the customer support number available on our webpage.

Brother Support said...

Are you looking to troubleshoot Brother Printer Offline status or unable to print from your installed brother printer. Visit Brother Support to do printer's configuring, settings and update related software drivers.

Barney Stinson said...

Epic Launcher is an online gaming platform which is highly popular among online games now-a-days. Where some find it interesting, and other are looking for how to uninstall epic games launcher form their device. If you also looking to uninstall epic games launcher, then visit the link in the topic.

Ashley said...

Amazing post. I am so impressed. Could never think of such a thing is possible with it...I think you have a great knowledge especially while dealings with such subjects.

Biology Assignment Help
Engineering Assignment help
Architecture assignment help
Biotechnology Assignment help
Computer Science Homework Help

Barney Stinson said...

Xbox one is one of the best gaming consoles till now. Many want to play every new game that came into the market. But because of the limited storage something there is a need to Delete Games on Xbox one to install some new ones. if you are looking for how to uninstall games from Xbox one then visit our web portal and there you will find the whole process about uninstalling games on Xbox one among some other interesting facts.

Freya Collins said...

If you need a good conclusions for essays you should read the list of the recommendations that we prepared because with it will help you to write your essay and ake the best impression on your professor.

Brother Customer Service said...

Brother Control Center supports Windows operating software, which give you quick and easy functions such as Scan, Print and fax and Brother Control center are not designed for Mac except control center 2 if applicable.

Leo5 said...

Awesome article! I want people to know just how good this information is in your article. It’s interesting, compelling content. Your views are much like my own concerning this subject.
Update Sony Xperia E3 D2206

sammer mark said...

I like to read your Post it is really nice please keep it up. If you Printer is facing issues such as Printer in Error State HP, Printer not Printing, etc then call our certified expert at our Toll-free number:- +1-844-802-7535 we are available 24 x 7.

Logan Smith said...

If you want to Set up your 123 HP Deskjet 2600 Setup, click on this link 123.hp.com/dj2600 to download drivers,

sammer mark said...

Thank you for the Post-it was nice. It is safe to say that you are confronting the Paper jam issue in your HP Printer? in this case that you have no clue how to sift through with this issue, at that point you no compelling reason to stress you simply interface up with HP Printer Installation group and get the best assistance from HP Experts.
Printer not Printing
Printer Customer Care
HP Printer Customer Service
HP Printer Toll-Free Number
HP Printer Customer Number
HP Printer Tech Support
HP Laserjet Printer Offline

HP Printer Supports said...

Hp support assistant software is one of the built-in features that comes with an HP device. It is given by the HP to help their customer regarding any issues, they might face while using a device. It helps in keeping your device up to dates and troubleshoot any errors that might come while using a device.

Logan Smith said...

Searching for HP Printer Drivers to introduce on your Windows PC? Try not to stress, you can finish the procedure absent a lot of exertion. You should simply explore to 123.hp.com on your PC. Presently select 'Programming and Drivers','Printers' and enter your printer model in the field. Download and introduce the ideal drivers from the rundown.

HP Printer Supports said...

Download HP support assistant, which is one of the built-in features that comes with an HP device. It is given by the HP to help their customer regarding any issues, they might face while using a device. It helps in keeping your device up to dates and troubleshoot any errors that might come while using a device.

Robert said...

whenever you try to print any document from my HP printer, some time it won't respond properly,
it might show "printer is offline" error.
the issue is mainly due to driver issue and you have to download the latest drivers from 123.hp.com/setup .
if you still can't fix it visit 123.hp.com and contact support team.

William Smith said...

My self, William Smith Associated with Livewebtutors. Which Is Known as A Renowned assignment help Australia Company. I Have Been Working as A Full-Time Academic Consultant from Last Ten Years. Livewebtutors Is an Experienced and Highly Reputable All Assignment Help Provider in Australia, Specialized in Academic Writing. We Offer High-Quality Service and Supply Free Plagiarism Report for All Assignments and Best Price.

marklee9161 said...

I am a new user of Garmin device and I don’t have any knowledge about How to update Garmin GPS. I am going to start my journey but I don’t have latest map updates. I read some blogs and articles but I think that was not complete solutions. If anyone have complete solution then please let me know.

Assignment Help Australia said...

Assignment Help provides excellent writing services to all students who find tough to finish their academic papers. Take the support of professional academic writer and lighten your stress.
Assignment Help Online
Online Assignment Help
Australia Assignment Help
Assignment Helper
Assignment Assistance
Assignment Help Experts
Online Assignment Help Services

sammer mark said...

Great Post for Beginner to understand. I sooner or later found excellent publish here. Thanks for information.keep sharing greater articles. We are Third Party Service Provider regarding the Printer any issues or setup. For More info Visit: Fix My HP Printer Offline

cassy said...

My friend promised to buy me a cup of coffee for referring him to your site. Thank you for coffee. Kindly keep updating us on new articles. These days, the most common pump for a shallow well is a jet pump. Jet pumps get mounted above the well, either in the home or in a good house, and draw the water up from the well through suction. Visit Best Shallow Well Pump for more.

Essabu said...

Thank you for bringing to a halt my long search topic. I really benefited from your content. If you are experiencing trouble striking a balance between your busy academic life and handling your online classes, you can get help from a professional who will take online classes on your behalf. It doesn’t matter the kind of help you need, whether it is passing your exam, finishing your assignments or even the entire classwork, you can get help here at Online Class Help .

Essabu said...

Thank you for bringing to a halt my long search topic. I really benefited from your content. If you are experiencing trouble striking a balance between your busy academic life and handling your online classes, you can get help from a professional who will take online classes on your behalf. It doesn’t matter the kind of help you need, whether it is passing your exam, finishing your assignments or even the entire classwork, you can get help here at Online Class Help .

avgcomretail said...

AVG Retail is outstanding stood out from various Antivirus programming. www.avg.com/retail Client can download the thing from.. The thing gives the total suite of the Avg subscription highlights which can www.avg.com/retail affirm your database from your.Item promise you similarly as control the check of your framework it will improve the speed of your structure utilizing the framework overhaul mechanical get together.

My Assignment Help Online said...

My Assignment Help is the most preferred place to get assignment help in Australia where we offer 100% plagiarism free and money back guarantee ensuring complete satisfaction of students with every order. Our professional in-house writers provide My assignment services online so that you can connect with us anytime and assign your work for a timely delivery of quality assignments.

My Assignment Help Online said...

My assignment help is the most preferred place to get assignment help Australia services where we offer 100% plagiarism free and money back guarantee ensuring complete satisfaction of students with every order. Our subject-specific experts are available 24x7 to provide properly formatted and referenced solutions in any subject from any level in Australian universities.

Jenifer Discota said...

All the students looking for service like HyperMash Assignment Help can come to us to get top notch assignment help service from top professionals in Australia. The guidance of our professional writers helps the students in completing their tasks on time at most affordable price.

Assignmenthelpsingapore said...

Nice Blog, if you need research paper writing service at an odd time of the day, you don’t have to worry. we have big team of experts in singapore, can resolve your query intantly. Online research paper help

William Smith said...

Via reading, you got me engaged and guess what? I would like to learn more on that. This is what is considered an entertaining message. Read more- accounting assignment help

Jenifer Discota said...

With an aera of knowledge and skills, we are the most trusted brand in providing computer network assignment help. If you are in need of our service then you can reach us via email, live chat or over phone and discuss with us your assignment requirements.

William Smith said...
This comment has been removed by the author.
William Smith said...

The post is quite informative and appears to be all-encompassing as I could derive a lot on the topic by reading through it. Read more- nursing assignment help