Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Embedded Linux Development

You're reading from   Mastering Embedded Linux Development Craft fast and reliable embedded solutions with Linux 6.6 and The Yocto Project 5.0 (Scarthgap)

Arrow left icon
Product type Paperback
Published in May 2025
Publisher Packt
ISBN-13 9781803232591
Length 710 pages
Edition 4th Edition
Tools
Arrow right icon
Authors (2):
Arrow left icon
Frank Vasquez Frank Vasquez
Author Profile Icon Frank Vasquez
Frank Vasquez
Chris Simmonds Chris Simmonds
Author Profile Icon Chris Simmonds
Chris Simmonds
Arrow right icon
View More author details
Toc

Table of Contents (28) Chapters Close

Preface 1. Part 1: Elements of Embedded Linux
2. Starting Out FREE CHAPTER 3. Learning about Toolchains 4. All about Bootloaders 5. Configuring and Building the Kernel 6. Building a Root Filesystem 7. Part 2: Building Embedded Linux Images
8. Selecting a Build System 9. Developing with Yocto 10. Yocto under the Hood 11. Part 3: System Architecture and Design Decisions
12. Creating a Storage Strategy 13. Updating Software in the Field 14. Interfacing with Device Drivers 15. Prototyping with Add-On Boards 16. Starting Up – The init Program 17. Managing Power 18. Part 4: Developing Applications
19. Packaging Python 20. Deploying Container Images 21. Learning about Processes and Threads 22. Managing Memory 23. Part 5: Debugging and Optimizing Performance
24. Debugging with GDB 25. Profiling and Tracing 26. Real-Time Programming 27. Index

Just-in-time debugging

Sometimes, a program will start to misbehave after it has been running for a while, and you would like to know what it is doing. The GDB attach feature does exactly this. I call it just-in-time debugging. It is available with both native and remote debug sessions.

In the case of remote debugging, you need to find the PID of the process to be debugged and pass it to gdbserver with the --attach option. For example, if the PID is 109, you would type this:

# gdbserver --attach :10000 109
Attached; pid = 109
Listening on port 10000

This forces the process to stop as if it were at a breakpoint, allowing you to start your cross GDB in the normal way and connect to gdbserver. When you are done, you can detach, allowing the program to continue running without the debugger:

(gdb) detach
Detaching from program: /home/frank/helloworld, process 109
Ending remote debugging.

Attaching to a running process by PID is certainly handy, but what about multi...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime