Discussion:
[Bug python/21698] New: Stepping from python interface broken?
belagod at gcc dot gnu.org
2017-07-01 10:22:49 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

Bug ID: 21698
Summary: Stepping from python interface broken?
Product: gdb
Version: 8.0.1
Status: NEW
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: belagod at gcc dot gnu.org
Target Milestone: ---

I built my trunk and 7.10 gdb configured as:

$ configure --disable-nls --disable-sim --disable-gas --disable-binutils
--disable-ld --disable-gprof --with-libexpat --with-lzma=no
--with-python=yes --prefix=/tmp/val/build-gdb/native/7.10/install/
--with-gdb-datadir=/tmp/val/build-gdb/native/7.10/install/share/gdb

on x86_64 Ubuntu 14.04

I'm trying to debug a program with gdbserver and gdb.

For trunk gdb,

In one terminal on host:

$ gdbserver localhost:3334 ./a.out
Process ./a.out created; pid = 17642
Listening on port 3334


Another terminal:

$ ../build-gdb/native/trunk/install/bin/gdb -x gdb_simple.py ./a.out
GNU gdb (GDB) 8.0.50.20170630-git
Copyright (C) 2017 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 "x86_64-pc-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 ./a.out...done.
(gdb) Reading /lib64/ld-linux-x86-64.so.2 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot"
to access files locally instead.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-2.19.so from remote target...
warning: the debug information found in "target:/lib64/ld-2.19.so" does
not match "target:/lib64/ld-linux-x86-64.so.2" (CRC mismatch).


Reading /lib64/.debug/ld-2.19.so from remote target...
0x00007ffff7ddb2d0 in ?? () from target:/lib64/ld-linux-x86-64.so.2
Step returned: ''
0x00007ffff7ddb2d3 in ?? () from target:/lib64/ld-linux-x86-64.so.2

<It stops here hanging>

For gdb 7.10:

$ gdbserver localhost:3334 ./a.out
Process ./a.out created; pid = 17642
Listening on port 3334

$ ../build-gdb/native/7.10/install/bin/gdb -x gdb_simple.py ./a.out
GNU gdb (GDB) 7.10.1.20160210-cvs
Copyright (C) 2015 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 "x86_64-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 ./a.out...done.
(gdb) Reading /lib64/ld-linux-x86-64.so.2 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot"
to access files locally instead.
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-2.19.so from remote target...
warning: the debug information found in "target:/lib64/ld-2.19.so" does
not match "target:/lib64/ld-linux-x86-64.so.2" (CRC mismatch).


Reading /lib64/.debug/ld-2.19.so from remote target...
0x00007ffff7ddb2d0 in ?? () from target:/lib64/ld-linux-x86-64.so.2
Step returned: '0x00007ffff7ddb2d3 in ?? () from
target:/lib64/ld-linux-x86-64.so.2
'
Step returned: '0x00007ffff7ddea40 in ?? () from
target:/lib64/ld-linux-x86-64.so.2
'
Step returned: '0x00007ffff7ddea41 in ?? () from
target:/lib64/ld-linux-x86-64.so.2
'
Step returned: '0x00007ffff7ddea44 in ?? () from
target:/lib64/ld-linux-x86-64.so.2
'
Step returned: '0x00007ffff7ddea46 in ?? () from
target:/lib64/ld-linux-x86-64.so.2
'
Stepping successful

Where gdb_simple.py is
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1700595/+attachment/4903671/+files/gdb_script_simple.py

and a.out is a hello world compiled using 'gcc -g hello.c'
--
You are receiving this mail because:
You are on the CC list for the bug.
belagod at gcc dot gnu.org
2017-07-01 04:53:50 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

Tejas Belagod <belagod at gcc dot gnu.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Host| |x86_64-linux
Build| |x86_64-linux
--
You are receiving this mail because:
You are on the CC list for the bug.
Hsiangkai at gmail dot com
2017-09-03 00:14:22 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

Hsiangkai Wang <Hsiangkai at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |Hsiangkai at gmail dot com

--- Comment #1 from Hsiangkai Wang <Hsiangkai at gmail dot com> ---
Currently, current_ui->prompt_state will keep PROMPTED value under python
interface. Synchronous commands will behave like asynchronous commands
and GDB will raise an exception while checking thread state before
executing synchronouse commands in ensure_not_running(). Initialize
current_ui->prompt_state to PROMPT_NEEDED in execute_gdb_command() to
ensure synchronous commands will complete before next command under python
interface.
--
You are receiving this mail because:
You are on the CC list for the bug.
Hsiangkai at gmail dot com
2017-09-03 00:34:21 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

--- Comment #2 from Hsiangkai Wang <Hsiangkai at gmail dot com> ---
I have prepared a patch for this bug. However, I am not sure is it reasonable
to change prompt_state in execute_gdb_command() or not. Any comments?

---
gdb/python/python.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index c53e10f..49b5eff 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -589,6 +589,7 @@ execute_gdb_command (PyObject *self, PyObject *args,
PyObject *kw)
struct interp *interp;

scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
+ current_ui->prompt_state = PROMPT_NEEDED;

scoped_restore save_uiout = make_scoped_restore (&current_uiout);
--
--
You are receiving this mail because:
You are on the CC list for the bug.
qiyao at gcc dot gnu.org
2017-09-05 11:45:41 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

Yao Qi <qiyao at gcc dot gnu.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |qiyao at gcc dot gnu.org

--- Comment #3 from Yao Qi <qiyao at gcc dot gnu.org> ---
(In reply to Hsiangkai Wang from comment #2)
Post by Hsiangkai at gmail dot com
I have prepared a patch for this bug. However, I am not sure is it
reasonable to change prompt_state in execute_gdb_command() or not. Any
comments?
gdb-***@sourceware.org is the right place to discuss patches, so post
your patch there. You can ask something you are not sure about there.
--
You are receiving this mail because:
You are on the CC list for the bug.
Hsiangkai at gmail dot com
2017-09-05 13:20:21 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

--- Comment #4 from Hsiangkai Wang <Hsiangkai at gmail dot com> ---
(In reply to Yao Qi from comment #3)
Post by qiyao at gcc dot gnu.org
(In reply to Hsiangkai Wang from comment #2)
Post by Hsiangkai at gmail dot com
I have prepared a patch for this bug. However, I am not sure is it
reasonable to change prompt_state in execute_gdb_command() or not. Any
comments?
your patch there. You can ask something you are not sure about there.
Thanks for your reminding. I have sent a patch to gdb-***@sourceware.org
for review.

https://patchwork.sourceware.org/patch/22595/
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-04-21 21:54:42 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21698

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Did this patch ever go in?
If not could you send a "ping" follow-up to the list?
--
You are receiving this mail because:
You are on the CC list for the bug.
Continue reading on narkive:
Loading...