LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-11-2015, 04:21 AM   #1
turboscrew
Member
 
Registered: Apr 2009
Location: Nokia (town), Finland
Distribution: Mint, Debian
Posts: 601

Rep: Reputation: 46
breakpoints and gdb-stub


Any pointers about how a gdb-stub should handle soft breakpoints in case of bare metal target?

The sources I've seen this far have assumed gdb-stub having an OS under it, and the 'gdb internals' seem to miss just those chapters.

What I'm wondering is when and where to put breakpoint instructions.
I think a helper breakpoint is needed in case of breakpoint set with 'Z'. My reasoning goes like:
1) Put breakpoint to given address and store the instruction replaced.
2) When the breakpoint is hit, wait for command.
3) If 'c' is given, restore the original instruction and set a helper breakpoint to the next instruction storing the replaced instruction.
4) Resume at the restored instruction.
5) When the helper breakpoint is hit, restore the stored instruction and re-install the original breakpoint.
6) Resume at the restored instruction.

And how to handle single-stepping over a place in code that has breakpoint set?

What's done by the gdb client and what's left to the gdb-stub to do?

Is the essential difference between a set breakpoint and a single-stepping breakpoint that single-stepping uses 'throwaway' breakpoints?

Last edited by turboscrew; 04-11-2015 at 04:27 AM.
 
Old 04-12-2015, 06:47 PM   #2
turboscrew
Member
 
Registered: Apr 2009
Location: Nokia (town), Finland
Distribution: Mint, Debian
Posts: 601

Original Poster
Rep: Reputation: 46
Found it out: It goes just like I thought (but instead of a 'helper' breakpoint, single step is used). GDB client removes the breakpoint ('z'), then single-steps ('s') and then re-installs the breakpoint ('Z').
Also stepping over a breakpoint is handled by GDB client the same way.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
breakpoints in gdb ashlesha Programming 3 06-05-2015 02:45 PM
[SOLVED] GDB: warning: Multiple breakpoints were set. Aquarius_Girl Programming 1 09-07-2011 03:04 AM
GDB - How to set breakpoints in files located outside the current dir chogall Programming 2 02-17-2011 03:25 PM
GDB debugger breakpoints cleopard Programming 1 05-07-2008 03:15 PM
gdb breakpoints cant find source file AM1SHFURN1TURE Programming 4 01-14-2006 01:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:11 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