public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28238] New: trying to run gdb on the core file(clang compile)
@ 2021-08-17  9:22 xuxing5 at huawei dot com
  2021-08-17  9:22 ` [Bug gdb/28238] " xuxing5 at huawei dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: xuxing5 at huawei dot com @ 2021-08-17  9:22 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28238
           Summary: trying to run gdb on the core file(clang compile)
           Product: gdb
           Version: 9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: xuxing5 at huawei dot com
  Target Milestone: ---

[root@openEuler-20 ~]# clang --version
clang version 10.0.1 (openEuler 10.0.1-1.oe1
8ce601c3ffe76c3a905ca6c867afe8d18becb409)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
[root@openEuler-20 ~]# cat test.
cat: test.: No such file or directory
[root@openEuler-20 ~]# cat test.c
#include <stdio.h>
#include <stdlib.h>

int main ()
{
        int value = 0;

        printf("The inverse of %d \n", value);
}

[root@openEuler-20 build-9234a6ab]# ./gdb/gdb ../../test
Python Exception <type 'exceptions.ImportError'> No module named gdb:
./gdb/gdb: warning:
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
GNU gdb (GDB) 9.2.90.20200913-git
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ../../test...
(gdb) run
Starting program: /root/test
The inverse of 0
[Inferior 1 (process 2911145) exited normally]
(gdb) list
Aborted (core dumped)

please help fix it

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/28238] trying to run gdb on the core file(clang compile)
  2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
@ 2021-08-17  9:22 ` xuxing5 at huawei dot com
  2021-08-17  9:25 ` [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump xuxing5 at huawei dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xuxing5 at huawei dot com @ 2021-08-17  9:22 UTC (permalink / raw)
  To: gdb-prs

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

xuxing5 at huawei dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
           Priority|P2                          |P1

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump
  2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
  2021-08-17  9:22 ` [Bug gdb/28238] " xuxing5 at huawei dot com
@ 2021-08-17  9:25 ` xuxing5 at huawei dot com
  2021-08-17 14:06 ` simark at simark dot ca
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xuxing5 at huawei dot com @ 2021-08-17  9:25 UTC (permalink / raw)
  To: gdb-prs

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

xuxing5 at huawei dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|trying to run gdb on the    |trying to run gdb on the
                   |core file(clang compile)    |core file(clang compile),
                   |                            |But gdb coredump

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump
  2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
  2021-08-17  9:22 ` [Bug gdb/28238] " xuxing5 at huawei dot com
  2021-08-17  9:25 ` [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump xuxing5 at huawei dot com
@ 2021-08-17 14:06 ` simark at simark dot ca
  2021-08-17 14:39 ` xuxing5 at huawei dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simark at simark dot ca @ 2021-08-17 14:06 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
Can you please try with GDB 11 and/or master?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump
  2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
                   ` (2 preceding siblings ...)
  2021-08-17 14:06 ` simark at simark dot ca
@ 2021-08-17 14:39 ` xuxing5 at huawei dot com
  2021-08-17 14:42 ` simark at simark dot ca
  2021-08-17 14:45 ` xuxing5 at huawei dot com
  5 siblings, 0 replies; 7+ messages in thread
From: xuxing5 at huawei dot com @ 2021-08-17 14:39 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from xuxing5 at huawei dot com ---
(In reply to Simon Marchi from comment #1)
> Can you please try with GDB 11 and/or master?

yeah, we try gdb-10, it is okay.
can you please fix the bug on the gdb-9-branch?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump
  2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
                   ` (3 preceding siblings ...)
  2021-08-17 14:39 ` xuxing5 at huawei dot com
@ 2021-08-17 14:42 ` simark at simark dot ca
  2021-08-17 14:45 ` xuxing5 at huawei dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simark at simark dot ca @ 2021-08-17 14:42 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Simon Marchi <simark at simark dot ca> ---
Unfortunately, there won't be any more releases of GDB 9 (nor 10).  But if you
really need it, you are free to backport the appropriate patches locally for
your own use.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump
  2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
                   ` (4 preceding siblings ...)
  2021-08-17 14:42 ` simark at simark dot ca
@ 2021-08-17 14:45 ` xuxing5 at huawei dot com
  5 siblings, 0 replies; 7+ messages in thread
From: xuxing5 at huawei dot com @ 2021-08-17 14:45 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from xuxing5 at huawei dot com ---
(In reply to Simon Marchi from comment #3)
> Unfortunately, there won't be any more releases of GDB 9 (nor 10).  But if
> you really need it, you are free to backport the appropriate patches locally
> for your own use.
we also find this commit cause the bug: please help me

commit 5c281dbb2458be9d58355e865f527e96b40bcd8c
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Aug 1 09:17:14 2019 -0600

    Don't call decode_line_with_current_source from select_source_symtab

    select_source_symtab currently calls decode_line_with_current_source.
    However, this function iterates over all program spaces, and so it is
    possible that it will return a "main" from some other program space.

    This patch changes select_source_symtab to simply use the symbol it
    already found in the current program space.

    gdb/ChangeLog
    2019-10-02  Tom Tromey  <tromey@adacore.com>

            * source.c (select_source_symtab): Don't call
            decode_line_with_current_source.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2417cfd371..d419fdfdae3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-02  Tom Tromey  <tromey@adacore.com>
+
+       * source.c (select_source_symtab): Don't call
+       decode_line_with_current_source.
+
 2019-10-02  Andrew Burgess  <andrew.burgess@embecosm.com>

        * symtab.c (lookup_global_symbol): Search global block.
diff --git a/gdb/source.c b/gdb/source.c
index ff218189495..9222df15050 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -252,17 +252,14 @@ select_source_symtab (struct symtab *s)

   /* Make the default place to list be the function `main'
      if one exists.  */
-  if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0).symbol)
+  block_symbol bsym = lookup_symbol (main_name (), 0, VAR_DOMAIN, 0);
+  if (bsym.symbol != nullptr && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
     {
-      std::vector<symtab_and_line> sals
-       = decode_line_with_current_source (main_name (),
-                                          DECODE_LINE_FUNFIRSTLINE);
-      const symtab_and_line &sal = sals[0];
+      symtab_and_line sal = find_function_start_sal (bsym.symbol, true);
       current_source_pspace = sal.pspace;
       current_source_symtab = sal.symtab;
       current_source_line = std::max (sal.line - (lines_to_list - 1), 1);
-      if (current_source_symtab)
-       return;
+      return;
     }

   /* Alright; find the last file in the symtab list (ignoring .h's

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-17 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  9:22 [Bug gdb/28238] New: trying to run gdb on the core file(clang compile) xuxing5 at huawei dot com
2021-08-17  9:22 ` [Bug gdb/28238] " xuxing5 at huawei dot com
2021-08-17  9:25 ` [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump xuxing5 at huawei dot com
2021-08-17 14:06 ` simark at simark dot ca
2021-08-17 14:39 ` xuxing5 at huawei dot com
2021-08-17 14:42 ` simark at simark dot ca
2021-08-17 14:45 ` xuxing5 at huawei dot com

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).