[Bug python/25312] New: Segmentation fault and/or other unintended behaivour when setting 'logging redirect' to 'on', and then using gdb.execute to set logging 'on' or 'off'

davidpel.dev at gmail dot com sourceware-bugzilla@sourceware.org
Tue Dec 24 10:12:00 GMT 2019


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

            Bug ID: 25312
           Summary: Segmentation fault and/or other unintended behaivour
                    when setting 'logging redirect' to 'on', and then
                    using gdb.execute to set logging 'on' or 'off'
           Product: gdb
           Version: 8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: davidpel.dev at gmail dot com
  Target Milestone: ---

Created attachment 12145
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12145&action=edit
Executing example - notice that logging redirect is not working properly when
executing starti

When using logging redirect, and then using python's gdb.execute to set logging
to on or off, gdb output is not properly redirected when using starti/stepi.
If an inferior is already present, and then 'logging' is modified using the
python api at any point, a seg fault will occur when continuing the execution
of the inferior.

Here's a quick way to reproduce the bug:

test.c:

  1 #include <stdio.h>
  2 
  3 
  4 int main()
  5 {
  6     printf("1");
  7     printf("2");
  8     printf("3");
  9     printf("4");
 10 
 11     printf("\n");
 12     return 0;
 13 }
 14 void func()
 15 {
 16 }
 17 

Then execute in gdb:

set logging redirect on
python
gdb.execute('set logging on')
end
file test
starti
set logging off
stepi

Running the example yields:

(base) david@david-VirtualBox:~/Documents/Github/opa-sim$ gdb -q
(gdb) set logging redirect on
(gdb) python
>gdb.execute('set logging on')
>end
(gdb) file test
(gdb) starti
Starting program: /home/david/Documents/Github/opa-sim/test 

Program stopped.
0x00007ffff7dd6090 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) set logging off
Done logging to gdb.txt.
(gdb) stepi
Segmentation fault (core dumped)

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


More information about the Gdb-prs mailing list