Update
This commit is contained in:
parent
dd3842ae42
commit
cc40dcb437
19 changed files with 1826 additions and 1819 deletions
12
debugging.md
12
debugging.md
|
@ -1,6 +1,6 @@
|
|||
# Debugging
|
||||
|
||||
Debugging is a term predominantly related to [computer](computer.md) technology (but sometimes also extended beyond it) where it stands for the practice of actively searching for [bugs](bug.md) (errors, design flaws, defects, ...) and fixing them; most typically it happens in software [programming](programming.md), but we may also talk about debugging [hardware](hardware.md) etc. Debugging is notoriously tedious and stressful, it can even take majority of the programmer's time and some bugs are extremely hard to track down, however systematic approaches can be applied to basically always succeed in fixing any bug. Debugging is sometimes humorously defined as "replacing old bugs with new ones".
|
||||
Debugging is a term predominantly related to [computer](computer.md) technology (but at times extended beyond it) where it signifies the practice of actively searching for [bugs](bug.md) (errors, design flaws, defects, ...) and fixing them; most typically it occurs as part of software [programming](programming.md), but we may also talk about debugging [hardware](hardware.md) etc. Debugging is notoriously tedious and stressful, it can even take majority of the programmer's time and some bugs are extremely hard to track down, however systematic approaches can be applied to basically always succeed in fixing any bug. Debugging is sometimes humorously defined as "replacing old bugs with new ones".
|
||||
|
||||
[Fun](fun.md) fact: the term *debugging* allegedly comes from the old times when it meant LITERALLY getting rid of bugs that broke computers by getting stuck in the relays.
|
||||
|
||||
|
@ -8,12 +8,12 @@ Debugging is a term predominantly related to [computer](computer.md) technology
|
|||
|
||||
## Debugging Software
|
||||
|
||||
Debugging programs mostly happens in these steps:
|
||||
Debugging of programs will commonly occur in these steps:
|
||||
|
||||
1. **Discovering bug**: you notice a bug, this usually happens during [testing](testing.md) but of course can also just happen during normal use etc.
|
||||
2. **Reproducing it**: reproducing the bug is extremely important -- actually you probably can't move on without it. Reproducing means finding an exact way to make the bug happen, e.g. "click this button while holding down this key" etc.
|
||||
2. **Reproducing it**: reproducing the bug is extremely important -- actually you probably can't move on without it. Reproducing denotes finding an exact way to make the bug manifest, e.g. "click this button while holding down this key" etc.
|
||||
3. **Locating it**: now as you have a crashing program, you examine it and find WHY exactly it crashes, which line of code causes the crash etc.
|
||||
4. **Fixing it**: now as you know why and where the bug exists, you just make it go away. Sometimes a [hotfix](hotfix.md) is quickly applied before implementing a proper fix.
|
||||
4. **Fixing it**: finally once you know why and where the bug exists, you just make it go away. Sometimes a [hotfix](hotfix.md) is quickly applied before implementing a proper fix.
|
||||
|
||||
For debugging your program it may greatly help to make **debugging builds** -- you may pass flags to your compiler that make the program better for debugging, e.g. with [gcc](gcc.md) you will likely want to use `-g` (generate debug symbols) and `-Og` (optimize for debugging) flags. Without this debuggers will still work but may be e.g. unable to tell you the name of function inside which the program crashed etc.
|
||||
|
||||
|
@ -27,11 +27,11 @@ The following are some of the most common methods used to debug software, roughl
|
|||
|
||||
### Eyeballing
|
||||
|
||||
Quick way to spot small bugs is obviously to just look at the code, however this really works for the small, extremely obvious bugs like writing `=` instead of `==` etc.
|
||||
A quick way to spot small bugs is obviously to just observe the source code, nevertheless this really just works for the small, extremely obvious bugs like writing `=` instead of `==` etc.
|
||||
|
||||
### Searching The Internet
|
||||
|
||||
Even for some less common errors just copy pasting the error message to the search engine usually reveals its most common cause on [Stack Overflow](stack_overflow.md). You will do this a lot when learning a new language/library/environment etc.
|
||||
Even for certain obscure and less frequent errors just copy pasting the error message to the search engine usually reveals its most common cause on [Stack Overflow](stack_overflow.md). You will do this a lot when learning a new language/library/environment etc.
|
||||
|
||||
### Manual Execution
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue