Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Post: GDB Tips and Tricks #9

Merged
merged 13 commits into from
May 2, 2019
Merged

New Post: GDB Tips and Tricks #9

merged 13 commits into from
May 2, 2019

Conversation

mafaneh
Copy link
Contributor

@mafaneh mafaneh commented May 2, 2019

No description provided.

Copy link
Member

@franc0is franc0is left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good! I left a few comments.


This is due to a few factors, some of which are:

- Limited availability of resources for debugging. For example, some bugs such as memory corruption are very difficult to diagnose using software breakpoints. In those scenarios, you would rely on hardware breakpoints and usually there is a limited number of hardware breakpoints for a specific architecture. This makes debugging complex bugs a challenging task.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't you use watchpoints rather than breakpoints for memory corruption?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'll update to reflect this.

To do that, open up a Terminal session and type the following:

```terminal
$ sudo vi /etc/paths
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an odd choice to me. Why not update the path in .bash_profile instead?

$ vi ~/.bash_profile
...
export PATH = <Your Folder>/nRF-Command-Line-Tools_9_8_1_OSX/nrfjprog:$PATH
export PATH = <Your Folder>/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update to reflect this.


```bash
# C flags common to all targets
#CFLAGS += $(OPT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't completely disable optimizations, instead it's easiest to use -Og or even just -O1 when you're debugging.

Worth adding a line to say all optimization levels will work, but some variables will disappear in higher optimization levels as they get optimized out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I'll make that change.

To start the J-Link GDB Server, run the following command:

```terminal
$ JLinkGDBServerCL -device nrf52840_xxaa -if swd -port 2331
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to explain that -if swd selects a SWD interface rather than JTAG. Modern chips all use SWD but older chips may require JTAG.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Mohammad Afaneh added 2 commits May 2, 2019 16:11
* mafaneh-gdb-tips-tricks-post:
  Updates to address comments by @francois
@mafaneh
Copy link
Contributor Author

mafaneh commented May 2, 2019

All changes should now be addressed by the latest commits

@franc0is
Copy link
Member

franc0is commented May 2, 2019

This is great! Go ahead and merge it. I'll fix up the image links once its in master.

@mafaneh
Copy link
Contributor Author

mafaneh commented May 2, 2019

This is great! Go ahead and merge it. I'll fix up the image links once its in master.

I don't think I have necessary permissions to merge it. Or am I missing something?

@franc0is franc0is merged commit 97751f8 into memfault:master May 2, 2019
@franc0is
Copy link
Member

franc0is commented May 2, 2019

Woops, you're right. Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants