[yocto] GDB with Eclipse *almost* working...
Bryan Evenson
bevenson at melinkcorp.com
Fri Sep 25 12:20:30 PDT 2015
All,
> -----Original Message-----
> From: yocto-bounces at yoctoproject.org [mailto:yocto-
> bounces at yoctoproject.org] On Behalf Of Bryan Evenson
> Sent: Friday, September 25, 2015 12:17 PM
> To: yocto at yoctoproject.org
> Subject: [yocto] GDB with Eclipse *almost* working...
>
> All,
>
> I almost have a full working setup with GDB in Eclipse for debugging remotely
> on my target hardware, but it's not quite there. Here's what I've done and
> where I'm at so far:
>
> 1. I have a custom image that I build, plus a few userspace applications. I use
> bitbake at the command line to build the full image. I have also built an SDK
> based on my production image and have been successfully using that SDK to
> build applications through Eclipse.
> 2. Followed the instructions for Eclipse as detailed in the "Working with
> Eclipse" section of the manual to install all the remote debugging related
> tools (GDB, TCF, etc.).
> 3. Created a dev image recipe that is the same as my base image recipe,
> except I added dev-pkgs and eclipse-debug to IMAGE_FEATURES. For the
> userspace applications I want to debug, I changed their reference in
> IMAGE_INSTALL to list the "-dbg" packages instead of the standard packages.
> I also added gdbserver to the IMAGE_INSTALL list.
> 4. Built my dev image and burned it to flash on my target hardware.
> 5. Upon starting my target hardware, I noticed that the executables and
> other supporting files for the packages I listed as -dbg were missing. I then
> by hand installed the standard packages (opkg install foo) to get all the files I
> needed.
> 6. From Eclipse, I created a new Debug configuration as detailed in
> "Deploying and Debugging the Application" section to setup for Remote
> Application debugging using TCF.
> 7. I added a "set sysroot" line to the .gdbinit for my application to point to the
> sysroot listed in the SDK I built in step 1.
> 8. I then launch debug and I am able to start the application on my target
> hardware. However, none of the source files are viewable. I get the error
> "No source available for main()" in the source window. I can run and pause
> the application and see the disassembly, but I can't see the source and set
> breakpoints.
>
> This is the closest I've ever got to debugging with GDB. Anyone know what
> final step I may be missing?
The application I was trying to debug was not an Autotooled project. I have another application that is an Autotooled project; I tried debugging the second one and I could see the source code just fine. Eclipse had properly set the CFLAGS properly so I could do a debug build. For the straight Makefile project, I have to set a variable so it does a debug build. Once I set the environment variable for the Debug configuration so that it would actually use "-g -O0" in the CFLAGS the source files showed up and I can now set breakpoints. So if you aren't seeing the source file, make sure that your application is really doing a debug build.
Regards,
Bryan
>
> Thanks,
> Bryan
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
More information about the yocto
mailing list