[Bug 2059856]

Cvs-commit 2059856 at bugs.launchpad.net
Tue Apr 2 20:06:57 UTC 2024


The master branch has been updated by Tom Tromey
<tromey at sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-
gdb.git;h=b1741ab0dafd899889faab6e862094a325a6b83c

commit b1741ab0dafd899889faab6e862094a325a6b83c
Author: Tom Tromey <tom at tromey.com>
Date:   Sat Mar 30 13:48:30 2024 -0600

    libiberty: Invoke D demangler when --format=auto
    
    Investigating GDB PR d/31580 showed that the libiberty demangler
    doesn't automatically demangle D mangled names.  However, I think it
    should -- like C++ and Rust (new-style), D mangled names are readily
    distinguished by the leading "_D", and so the likelihood of confusion
    is low.  The other non-"auto" cases in this code are Ada (where the
    encoded form could more easily be confused by ordinary programs) and
    Java (which is long gone, but which also shared the C++ mangling and
    thus was just an output style preference).
    
    This patch also fixed another GDB bug, though of course that part
    won't apply to the GCC repository.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31580
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30276
    
    libiberty
            * cplus-dem.c (cplus_demangle): Try the D demangler with
            "auto" format.
            * testsuite/d-demangle-expected: Add --format=auto test.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/2059856

Title:
  gdb 10.0 fails to examine any global variables in D programs

Status in gdb:
  Fix Released
Status in gdb package in Ubuntu:
  New

Bug description:
  [ Impact ]

   * GDB 10.0 introduced a regression where it cannot inspect any global variables in any D programs compiled by any D compiler.
   * LDC2 and GDC upstream stated Focal does not have such a problem and stuck to this release for their test images.

  [ Test Plan ]

  Considering the following D program:

  ```
  module t;

  class uv {
      int i;
  }

  __gshared uv i;
  int main() {
      i = new uv();
      return 0; // #break
  }
  ```

  If you build it using `gdc -g -O0 t.d -o t` or `ldc2 -o t.o t.d -g`,
  run the GDB using the following commands ...

  ```
  b t.d:10
  p t.i
  ```

  ... you will notice GDB will complain that "'t.i' has unknown type;
  cast it to its declared type."

  [ Where problems could occur ]

    * The fix consists of a single line change to the demangler. The worst-case scenario would be breaking the demangling functionality of other programming languages. However, the newer D ABI uses a symbol mangling scheme that is very difficult to confuse with other programming languages.
    * Incorrect symbol de-mangling may also cause user confusion. However, the patch fixed a fundamental usability issue.

  [ Other Info ]

    * Initial discussion in the LDC2 bug tracker:
  https://github.com/ldc-developers/ldc/issues/4389

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdb/+bug/2059856/+subscriptions




More information about the foundations-bugs mailing list