LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2014, 04:59 AM   #1
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
How to know whether you have excellent debugging skills or not?


Firstly, I'd like to know what does the term "debugging
skills" constitute of, exactly?

Certainly it isn't about knowing the "commands" of GDB.
I won't consider knowing the commands of GDB "a skill".

What should be an idle approach to debug someone else's
code?
How do you improve yourself as a debugger?

Finally,
How to know whether you have excellent debugging
skills or not?

Last edited by Aquarius_Girl; 03-04-2014 at 05:03 AM.
 
Old 03-04-2014, 08:57 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Not clear what "an idle approach" is but to debug someone else's code you would need to understand which part of the code is generating the bug symptoms. Sometimes that is all that is required; the defect becomes obvious on inspecting the code. For more intransigent bugs you would also need to study the code and the data structures sufficiently to identify how and where the intended data changes differ from the actual.

Sometimes there are shortcuts like knowing that the bug has appeared recently and the recent code changes. Or the inputs have changed ...

Improvement by practice and critical self observation? By noting which techniques were effective and which not? By working with others and learning their techniques?

Excellence? When you are asked to do it repeatedly -- or maybe that just says your colleagues won't do it
 
2 members found this post helpful.
Old 03-04-2014, 09:42 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by catkin View Post
Not clear what "an idle approach" is but to debug someone else's code you would need to understand which part of the code is generating the bug symptoms. Sometimes that is all that is required; the defect becomes obvious on inspecting the code. For more intransigent bugs you would also need to study the code and the data structures sufficiently to identify how and where the intended data changes differ from the actual.

Sometimes there are shortcuts like knowing that the bug has appeared recently and the recent code changes. Or the inputs have changed ...

Improvement by practice and critical self observation? By noting which techniques were effective and which not? By working with others and learning their techniques?

Excellence? When you are asked to do it repeatedly -- or maybe that just says your colleagues won't do it
Agree with all of this...well said, catkin.
 
Old 03-04-2014, 10:58 AM   #4
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
I think debugging starts with good coding. Code in a such a way that it prevents you and others from making mistakes.

Use functions that are not prone to buffer overflow. Do plenty of bounds checking on input. For conditional statement I always put the constant on the left of the '==', just in case someone changes it to '=', by mistake or maliciously as was seen in a recent kernel bug. Use assert to test variables before using them in calculations. In cryptography many developers include the size of the type in the name of the variable to make sure you're not mistakenly using the wrong function on a type of the wrong size. You should do this when the type size matters, and I recommend using 'stdint.h' when type size matters. I use these for everything but counters if I know the counter is not going to overflow in any situation. Turn on all compiler warnings. Learn how to use gdb, which is helpful in case you have a large program and have no clue where the error might be, it can tell you exactly.

Last edited by metaschima; 03-04-2014 at 11:01 AM.
 
Old 03-04-2014, 11:46 PM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
The reason I asked this question was that I saw in a job
advertisement the following as a requirement:

"excellent debugging skills"

Question framed differently:

How, in an half an hour interview, you'd judge whether the
candidate has some debugging skills or not?
In this thread I am talking about debugging someone else's
code with which you are NOT familair.
 
Old 03-05-2014, 12:37 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Actually "excellent debugging skills" itself has no any meaning, it depends on the language, platform .... 30 years ago I reverse-engineered games written for Commodore 64.
20 years ago I have remote debugged shared libraries loaded runtime on HP-UX (that was our own C++ code).
Is that ok for you?

That would be the CV, and if you were really interested just ask him/her to tell about his/her adventures. Probably he has an exciting story related to debugging...
 
1 members found this post helpful.
Old 03-05-2014, 12:40 AM   #7
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Didn't know that it would matter so I didn't mention
that it was for C++ on Linux.
 
Old 03-05-2014, 06:08 AM   #8
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
If you are the goto person in your group for debugging, then and only then you will have the debugging skills.

Time was (before the advent of large, standard packages), most programmers got to actually debug once in a while (during the support phase) or often (during the development phase). Then it was all about good understanding of what the program should do, ability to browse the code and zero in on the problem segment, suggest test data and integrate the code into the next release etc.

Now with packages, I suspect that the core programmer is now dumbed down to a coder who codes to very detailed specs and is given less leeway. Debugging would be done by the seniors (or toolsmith, tester or language lawyer in Brooks "Mythical Man Month"). These skills needed would be a full knowledge of the requirement, environment, tools and proper (and by elimination what is improper) language constructs. If you are good at these, you have the skills.

OK

Last edited by AnanthaP; 03-05-2014 at 06:23 AM.
 
Old 03-05-2014, 07:01 AM   #9
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I spend a lot of my time debugging the hardest problems from other engineers' work. I'm very good at it.

Most of it is the ability to think. Rely less on what you know or think you know and rely more on deductive ability, intelligence rather than knowledge. Experience and knowledge can also help, but not if they are all you rely on.

In almost all the debugging I do, the engineer who previously tried to debug the problem knew more about the topic and the algorithm, not just more about the code he wrote. Most engineers rely too much on knowledge when thought is required.

To debug effectively, you need to be able to quickly form plausible theories from very incomplete evidence and quickly figure out what to look at that would support/refine the theory, or more often disprove the theory giving you the basis for a new theory. In a consulting job years ago, I worked closely with a technical hands-on boss, who very much appreciated the results I achieved trouble shooting the work of the full time employees he managed. He frequently commented that it was a flaw in my process that I formed theories too early with too little evidence and was usually wrong. But that is the process. A good "wrong" theory is the right tool for guiding an investigation and gets you to the right answer a lot faster than just gathering evidence without a theory. Of course you need the confidence and personality to avoid confirmation bias. Never try to defend a theory. You might need to argue in favor of a theory to get support from others in a large project for the effort needed to investigate the theory. But investigating a theory still must be attacking it, not defending it, even though it is your own theory.

Quote:
Originally Posted by Anisha Kaul View Post
How, in an half an hour interview, you'd judge whether the
candidate has some debugging skills or not?
I can't imagine how one might do that. Even though I have that skill myself, I would not know any way to measure it in an interview setting. Most interviewers are even further from being able to measure that skill because they don't have it themselves and would misunderstand it even after seeing it in action.

Quote:
Originally Posted by pan64 View Post
Actually "excellent debugging skills" itself has no any meaning, it depends on the language, platform
I couldn't disagree more. "Excellent debugging skill" is independent of not just the language, but even the discipline.

I have no training and not much knowledge in circuit design, but in previous jobs and consulting positions I was very effective at debugging the hardest problems in complicated circuit design work done by experienced knowledgeable engineers, who were not able to debug those problems in their own designs themselves.

In my current and previous jobs, I have debugged programming problems in languages I didn't know in algorithms based on advanced mathematics that I don't know.

Relevant knowledge and experience is ALSO very helpful in debugging. But it is never enough, while debugging skill and raw intelligence often is enough. Most of my recent debugging has been in C++. In debugging hard problems in C++, I rely on a solid knowledge of the underlying assembler language. I started debugging hard problems in C++ before I learned C++ or could code in it. So I needed to look at the generated asm code to discover what the C++ code meant. I'm now a very experienced and skilled C++ coder. But I still look more at the asm than at the C++ when debugging any difficult C++ problem. It is far too easy in C++ to code something that looks very much like it means one thing, but really means another. It may be rare (across all our code) for an instance of that to be tricky enough to fool a C++ coder at my level. But I'm debugging problems that were too tough for other experienced C++ programmers before I ever looked at them. So the starting point is the fact that something unusually difficult is involved.

Last edited by johnsfine; 03-05-2014 at 07:23 AM.
 
1 members found this post helpful.
Old 03-05-2014, 07:35 AM   #10
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
IMO Debugging -ne Troubleshooting

Debugging is the act of looking for 'bugs' or processes in a program/computer that aren't doing what they are intended to do. Bugs get there by programmers that mistakenly put bad code in, don't test, or don't have sufficient time to test the impact of code on the many other facets of the program. It's usually unforeseen.

Troubleshooting is "My car won't start, Ill check the gas, then the battery, then the fuel lines." And the problem is BOUND to happen. It's mechanical. And that basic troubleshooting process never changes.

With code, if you see the cursor disappear, it could be any of a million lines of code, in a hundred different files or subsystems.

What makes you a good "debugger"?

Let me answer this way: What makes you a good doctor? What makes you a good physicist? Education, training, and practice.

Additionally, It should be said that you can be good one place and not as good at another. For example, I've worked where I work so long that I can debug any of the C or PHP crap that we have lying around usually within the day. But a quick jump onto the Fedora site, looking at a bug for a cursor, I can tell you that without further training, and knowledge of the system, I'm not going to be as good at debugging it.

Last edited by szboardstretcher; 03-05-2014 at 07:46 AM.
 
1 members found this post helpful.
Old 03-05-2014, 08:32 AM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Anisha Kaul View Post
The reason I asked this question was that I saw in a job
advertisement the following as a requirement:

"excellent debugging skills"

Question framed differently:

How, in an half an hour interview, you'd judge whether the candidate has some debugging skills or not? In this thread I am talking about debugging someone else's code with which you are NOT familair.
The way I'd view it, is I'd want to see how the candidate thinks about a problem. How they'd troubleshoot it, and what steps they'd take to figure it out. There isn't going to be a 'right' answer, in my opinion. I'd look for more than just the canned answer about running things through a debugger, and focus on the thinking that leads them there. Did they check obvious things first? (log files, running the program in verbose mode/foreground, check other processes that the program depends on, etc.) I look for flexibility in thinking, rather than someone who just knows one way to view every problem.
 
1 members found this post helpful.
Old 03-05-2014, 11:49 AM   #12
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
As a job seeker, that kind of line in a job ad is a red flag. At best it makes the job seem like a temporary one. At worst you get to look bad making a terrible system less terrible.

As far as a good debugger. Knowing the system that is buggy. Knowing the languages used. Knowing the debugging software. And make no assumptions, actually verify that everything works as advertised. Also know the differences between the development and production environments.
 
Old 03-06-2014, 09:19 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Consider the following program:
Code:
loop:  goto loop;
This program is supposed to print a copy of Lincoln's Gettysburg Address. (That's what the consultant who sold it to us for $50,000 promised it would do.) But it is taking too long to complete. Using only the GDB debugger, make it do so. Before lunch, please.
 
Old 03-06-2014, 10:33 AM   #14
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Rule Number 1. Fix more than you break.
 
Old 03-06-2014, 11:44 AM   #15
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
'His debugging skills are exceptional.'
http://www.cartoonstock.com/directory/d/debugging.asp

;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Jan 2014 IT Skills Watch report: three IT skills on the rise LXer Syndicated Linux News 0 01-22-2014 01:00 PM
[SOLVED] Can you give some tutorials for debugging release version skills. : ) gchen Programming 9 06-13-2012 08:36 PM
[SOLVED] Effective debugging or improving ones debugging skills Ajit Gunge Programming 3 05-22-2009 09:29 AM
Difference between kernel - debugging and application debugging topworld Linux - Software 2 03-30-2006 12:50 AM
Visual Debugging and Linux Kernel Debugging Igor007 Programming 0 09-30-2005 10:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration