Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Some notes on porting Delve to PPC64LE

December 19, 2022
Alejandro Sáez Morollón
Related topics:
GoLinux
Related products:
Red Hat Enterprise Linux

    Delve is a debugger for Go programs that currently supports multiple architectures and operating systems. At the time of this writing, Delve supports Linux on x86_64, aarch64, and 386, Windows on x86_64, and macOS on x86_64. These are the most common architectures that Go supports. But the list of potential architectures is long, and on that list is PPC64LE, an architecture that a significant amount of users use on servers. PPC64LE is the code name for the little endian mode of the Power ISA, introduced by Power8 around 2013. You can run Linux operating systems such as Red Hat Enterprise Linux (RHEL) or Fedora on this architecture.

    While working on a bug that targeted RHEL on PPC64LE, I realized that I needed a debugger and the options were limited. You can use GDB, which runs flawlessly on PPC64LE and understands Go binaries, but it needs to understand Go programs better. Delve does a better job of understanding the runtime and data structures. But Delve doesn't support PPC64LE at that point. So I asked myself: How hard could it be to port Delve to PPC64LE? As you might have guessed, this is my first port ever.

    Porting is hard

    By porting, people usually refer to adapting something existing to a different scenario. It can be to another operating system, CPU architecture, library, etc.

    When porting a piece of software to a different CPU architecture, as in our case, if the compiler and the libraries support the targeted architecture, there is little work to do. Most things would work out of the box. But a debugger like Delve needs to intercept system calls and understand CPU registers, among other things, so even though Go supports PPC64LE, the amount of work necessary can be considerable.

    Documentation

    As in any other project, the first step is to gather documentation. And for these kinds of projects, the first things to check are the official specifications and other projects that already support the architecture.

    Most of the Power documentation can be found on the OpenPower Foundation web page. In particular, the most meaningful documents are the ELF ABI specification and the Power ISA books. Beware that these are lengthy documents. Apart from these documents, the DWARF documentation is a must-have.

    As a side note, I can't recommend Zotero enough if you struggle with documentation organization. Give it a try.

    Finding other projects that already implement the architecture always helps. In this case, the way in which Go, LLVM, and GDB handle registers was quite instructive. Checking the Linux kernel code also helped in multiple situations. For these kinds of scenarios, nothing beats checking similar projects' source code repositories. As a pro tip: Always use the control version repository advance search to filter out irrelevant files.

    Another thing you can do is check other ports in the same project. Even if they're not on the same architecture, checking how other ports were done is vital to understand what you need to do.

    Testing

    To test your code, you will need a laboratory. For PPC64LE, there are different routes that we can follow. The easiest and the most comfortable to use is an SSH connection to a machine. Some folks prefer to work directly in the lab, while others like to work on their local devices and copy the code to the lab. I'm currently doing the latter, but if you want to do the former, be sure to save your work constantly. You want to maintain your changes in a safe place when refreshing the lab to a clean state. For those who wish to follow my work-local/run-remotely approach, rsync and inotify are your friends. I detected changes with inotify and synced everything to the remote laboratory.

    If you don't have access to a device, check Linux distributions. Some of them might give you access to shared virtual or real servers where you can test the code if you are part of the projects and the work you plan to do is relevant to them.

    Another route is to use virtual laboratories. If you choose this path, remember that the performance might be worse than using a server. On the other hand, the cost is almost zero. For PPC64LE, the best approach is to use QEMU or the official IBM Power simulator. Both work flawlessly. I started the port with QEMU, but I eventually moved to a server because the emulation was really slow on my machine.

    Debugging a debugger

    Luckily, Delve has an impressive test suite. That gives me a privileged starting point: Every single test must pass.

    As simple as it sounds, sometimes things can get messy. How do you debug a debugger when you don't have a debugger? Well, I have three tools:

    • print("HERE!"): This is the most common line I have written. Printing variable values, memory states, and complex structures immensely helped me. It might not be fancy, but it sure is effective.

    • panic("NOT IMPLEMENTED"): Sometimes, you need to implement methods and functions that you don't understand yet to compile your code. Instead of only adding a TODO comment, also add a panic. Make your code fail. Later, when a piece of code you are trying to make work suddenly panics, you can quickly jump into the offending piece of code.

    • Pen and paper: This is probably the trickiest of all. Using the previous two tools allows you to follow the execution of the code and print where things break. Still, it would be best if you had a way to visualize the calls to keep you focused and not overwhelmed by the issue's complexity. Sketching diagrams, writing function names, and keeping a list of questions to yourself or others who might know more than you help put thoughts in the proper place. Usually, this helps in understanding the issue. Don't underestimate the power of the paper!

    Conclusion

    What is the current state of the whole port? It's almost done! There are a few tests left —four at the time of this writing— that I need to fix, and once they're resolved I will be able to submit the work upstream. Hopefully, this will happen soon.

    As you can see, porting is intricate and takes time. But the results are well worth it. Users of PPC64LE will be able to debug complex scenarios with a familiar tool and spend less time fixing bugs. And to be honest, it is an exciting project to work on!

    Last updated: March 14, 2023

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

    cheat sheet cover image

    Ready to level up your Linux knowledge? Our Intermediate Linux Cheat Sheet presents a collection of Linux commands and executables for developers and system administrators who want to move beyond the basics.

    Get the cheat sheet
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI