public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dmitry.neverov at jetbrains dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/31295] Slow symbol lookup due to missing DW_AT_const_value attribute
Date: Fri, 26 Jan 2024 09:31:02 +0000	[thread overview]
Message-ID: <bug-31295-4717-GToDtSsKZW@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31295-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31295

--- Comment #3 from Dmitry Neverov <dmitry.neverov at jetbrains dot com> ---
Sorry, I didn't describe it properly, the setup is more
complicated. The wxString should be in shared library.

$ cat str.h
#ifndef STR_H
#define STR_H
#include <cstdlib>

class wxString
{
public:
    static const size_t npos;
    char *data;
    size_t len;
};

#endif //STR_H

$ cat str.cpp
#include "str.h"

const size_t wxString::npos = (size_t) -1;

$ cat util.h
#ifndef UTIL_H
#define UTIL_H

int f();

#endif //UTIL_H

$ cat util.cpp
#include "util.h"
#include "str.h"

int f() {
  wxString s = {};
  return s.len == wxString::npos ? 1 : 0;
}

$ cat main.cpp
#include <iostream>
#include "str.h"
#include "util.h"

int main() {
  wxString str = {};
  std::cout << wxString::npos << std::endl;
  std::cout << f();
  return 0;
}

$ g++ -g -fPIC -c str.cpp
$ g++ -shared -o libstr.so str.o
$ g++ -g -c util.cpp
$ g++ -g -I. -L. -o main main.cpp util.o -lstr
$ gdb -q --batch main -ex "set trace-commands on" -ex "set logging enabled on"
-ex "b main.cpp:7" -ex "run" -ex "maint info symtab" -ex "print str" -ex "maint
info symtab"

The last command shows that "print str" at main.cpp:7 loads
util.cpp.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-01-26  9:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 16:24 [Bug symtab/31295] New: " dmitry.neverov at jetbrains dot com
2024-01-25 18:58 ` [Bug symtab/31295] " dmitry.neverov at jetbrains dot com
2024-01-26  3:26 ` tromey at sourceware dot org
2024-01-26  5:22 ` vries at gcc dot gnu.org
2024-01-26  9:31 ` dmitry.neverov at jetbrains dot com [this message]
2024-01-26 11:41 ` ssbssa at sourceware dot org
2024-01-26 12:28 ` vries at gcc dot gnu.org
2024-01-26 13:28 ` dmitry.neverov at jetbrains dot com
2024-01-26 15:43 ` vries at gcc dot gnu.org
2024-01-27 11:09 ` sam at gentoo dot org
2024-01-28 20:23 ` tromey at sourceware dot org
2024-01-29  1:10 ` tromey at sourceware dot org
2024-02-11 17:52 ` tromey at sourceware dot org
2024-02-11 20:37 ` tromey at sourceware dot org
2024-02-11 21:15 ` tromey at sourceware dot org
2024-02-12 15:44 ` vries at gcc dot gnu.org
2024-02-12 20:28 ` tromey at sourceware dot org
2024-02-16  2:32 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31295-4717-GToDtSsKZW@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).