Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
hello-world
tools
Commits
a341b7c3
Commit
a341b7c3
authored
4 years ago
by
Erik Strand
Browse files
Options
Downloads
Patches
Plain Diff
Break the example code
parent
12b118fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gdb/README.md
+3
-0
3 additions, 0 deletions
gdb/README.md
gdb/main.cpp
+2
-1
2 additions, 1 deletion
gdb/main.cpp
with
5 additions
and
1 deletion
gdb/README.md
+
3
−
0
View file @
a341b7c3
...
@@ -21,6 +21,9 @@ build it from [source](https://www.gnu.org/software/gdb/current/).
...
@@ -21,6 +21,9 @@ build it from [source](https://www.gnu.org/software/gdb/current/).
## Debugging on Your Computer
## Debugging on Your Computer
Let's try running the example program in this directory. It should tell us which numbers are prime.
But there seems to be a problem.
## Debugging on Your Microcontroller
## Debugging on Your Microcontroller
I'll refrain from
I'll refrain from
This diff is collapsed.
Click to expand it.
gdb/main.cpp
+
2
−
1
View file @
a341b7c3
#include
<iostream>
#include
<iostream>
#include
<cmath>
// This is a simple function that checks if numbers are prime. Or does it? There may be a bug...
// This is a simple function that checks if numbers are prime. Or does it? There may be a bug...
bool
is_prime
(
int
x
)
{
bool
is_prime
(
int
x
)
{
for
(
int
i
=
2
;
i
<
x
/
2
;
++
i
)
{
for
(
int
i
=
2
;
i
<
std
::
sqrt
(
x
)
;
++
i
)
{
if
(
x
%
i
==
0
)
{
if
(
x
%
i
==
0
)
{
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment