GDB Vs LLDB debuggers

40,794

Solution 1

LLDB is part of the LLVM suite of tools that Apple is moving to, including Clang. There are tons of improved features, including improved performance. There's a quick intro for GDB users here: http://lldb.llvm.org/tutorial.html

However...

You might want to take a trip over to the forums at developer.apple.com. There's a fair bit of rumbling about issues with LLDB at the moment (in XCode 4.3.1). One nasty issue, which people from Apple have confirmed, is that viewing ivars while stepping may show you the wrong values.

Solution 2

1. By Difference of Definition

First, What is GDB?

"GDB is the standard debugger for the GNU software system"
The GNU Debugger, usually called just GDB and named gdb as an executable file, is the standard debugger for the GNU operating system. However, its use is not strictly limited to the GNU operating system; it is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, C, C++, Objective-C, Free Pascal, Fortran, Java1 and partially others.2

(quotation from wikipedia)

Second, What is LLDB?

"LLDB is a debugger built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project, such as the Clang expression parser and LLVM disassembler.
LLDB is Apple’s “from the ground up” replacement for GDB, developed in close coordination with the LLVM compilers to bring you state-of-the-art debugging with extensive capabilities in flow control and data inspection. Starting with Xcode 5, all new and preexisting development projects are automatically reconfigured to use LLDB. The standard LLDB installation provides you with an extensive set of commands designed to be compatible with familiar GDB commands. In addition to using the standard configuration, you can easily customize LLDB to suit your needs.

(quotation from Apple official site)
/* I tried to find actual / practical datas to prove the statement : LLDB is already much faster than GDB when debugging large programs.) However, I could not find it. if there is someone having this related data, please edit this article. */

Both GDB and LLDB are of course excellent debuggers without doubt.
GDB is debugger part of the GNU project created to work along the GNU compiler.
LLDB is debugger part of the LLVM project created to work along LLVM compiler.

2. By Difference of Debugger Command usage

The majority of the commands are the same.
However, lldb and gdb, two different debuggers are developed by different set of developers and thus have a little bit different commands.

This is good link below for comparing difference of these two debugger commands.
let me link the detail below : https://developer.apple.com/library/content/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html

http://lldb.llvm.org/lldb-gdb.html

This clearly indicates and organizes the difference of commands.

In case the site is not accessible anymore, I summary the major difference of commands below from the linked site.

Execution command difference between GDB and LLDB Break-Point command difference between GDB and LLDB Examining variable command difference between GDB and LLDB Examining thread state command difference between GDB and LLDB

3. By Personal Opinion

LLDB has been fully integrated from Xcode IDE 5 by default as primary debugger.
From that time, there has been some complaint report about LLDB stability, performance issues and bugs.
However, LLVM with LLDB project has been being incredibly improved and upgraded so far as the one of the core open-source project in the world.
So, I think, at least, LLDB should be used for Apple development environment since LLDB stole the position of GDB and is already primary default debugger at least in Apple world.
(In late September, 2016, Xcode 8 integrating LLVM and LLDB was officially released, meaning quite a lot of time has been passed since LLVM/LLDB is default tool-chain for Xcode.)
But, We all already know GDB has been historically and strongly verified and battle-proven debugger over 30 years, which is awesome.

So, I would say…
I would like to use lldb while using clang, use gdb while using gcc compiler as the good combination or pair because lldb is based on llvm, whereas gdb is a GNU debugger.

I wish it could be helpful for you.

Thanks.

Share:
40,794
Abhinav
Author by

Abhinav

Updated on July 08, 2022

Comments

  • Abhinav
    Abhinav almost 2 years

    What is the difference between GDB & LLDB debuggers? I recently upgraded my Xcode version from 4.2 to 4.3 & started getting warning to upgrade my debugger from GDB to LLDB.

  • Richard J. Ross III
    Richard J. Ross III about 12 years
    That error is why you'll find me using GDB for the time being :)
  • Martijn Courteaux
    Martijn Courteaux almost 12 years
    Thanks for mentioning this issue! I was getting crazy about what the LLDB debugger showed me. It was quite impossible. GDB works better, indeed.
  • Saturn
    Saturn almost 11 years
    Hello. It has been a year now. Is LLDB still not-so-great?
  • infinitetape
    infinitetape almost 11 years
    LLDB has definitely gotten better. You'd best start transitioning, once [Redacted] 5 is released, GDB will be gone for good.