Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 483262 - Valgrind doesn't work with GDB properly
Summary: Valgrind doesn't work with GDB properly
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gdb
Version: 4.6
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Jan Kratochvil
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On: 233746 453688
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-30 16:13 UTC by Jan Kratochvil
Modified: 2010-09-14 03:36 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 453688
Environment:
Last Closed: 2010-09-14 03:36:08 UTC


Attachments (Terms of Use)

Description Jan Kratochvil 2009-01-30 16:13:06 UTC
+++ This bug was initially created as a clone of Bug #453688 +++

Description of problem:
Attempting to use valgrind with --db-attach=yes on a program that triggers an
error, and then attaching gdb causes gdb to error, and is unusable. Once gdb
exits, valgrind resumes control, and the program (seems to) continue normally.

Version-Release number of selected component (if applicable):
broken: RHEL-4.6 gdb-6.3.0.0-1.153.el4.x86_64 (by valgrind-3.1.1-1.EL4.x86_64)
OK:     RHEL-4.5 gdb-6.3.0.0-1.143.el4.x86_64 (by valgrind-3.1.1-1.EL4.x86_64)

How reproducible:
Every time

Steps to Reproduce:
1. Create a program that causes valgrind to detect an error, such as an invalid
read or write. The following example is sufficient
#include <stdlib.h>

int
main() {
  int* arr = (int*)malloc(8);
  int j = arr[30];
  return 0;
}

2. Compile the example program (gcc -g3 -Wall val-db.c -o val-db)
3. Run valgrind with the following options "valgrind --db-attach=yes ./val-db"
  
Actual results:
GDB freaks out, and cannot debug. The following occurs on-screen:
[bash]root@x86-64-4as-6-m1.lab.bos.redhat.com:/root/jkratoch/redhat# valgrind --db-attach=yes ./val-db
==25917== Memcheck, a memory error detector.
==25917== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==25917== Using LibVEX rev 1575, a library for dynamic binary translation.
==25917== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==25917== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
==25917== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==25917== For more details, rerun with: -v
==25917== 
==25917== Invalid read of size 4
==25917==    at 0x4004C6: main (val-db.c:6)
==25917==  Address 0x4A3C0A8 is not stack'd, malloc'd or (recently) free'd
==25917== 
==25917== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- y
==25917== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- starting debugger
==25917== starting debugger with cmd: /usr/bin/gdb -nw /proc/25918/fd/1014 25918
GNU gdb Red Hat Linux (6.3.0.0-1.153.el4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/tls/libthread_db.so.1".

Attaching to program: /proc/25918/fd/1014, process 25918
Redelivering pending Segmentation fault.

valgrind: m_signals.c:1001 (default_action): Assertion 'VG_(is_running_thread)(tid)' failed.
==25918==    at 0x70010E08: report_and_quit (m_libcassert.c:122)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==25918==    at 0x4004C6: main (val-db.c:6)


Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what Linux distro you are using.  Thanks.

Program process 0 exited: 1 (exited)

/root/jkratoch/redhat/25918: No such file or directory.


Expected results:
GDB attaches properly, and developer is able to debug the process.

Additional info:

Comment 1 Jan Kratochvil 2009-01-30 16:18:51 UTC
Regression by the Bug 233746:
* Mon Jul 30 2007 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.3.0.0-1.151
- Never lose any pending signal while attaching - resubmit them (BZ 233746).

Comment 2 RHEL Product and Program Management 2009-01-30 17:17:05 UTC
This bugzilla has Keywords: Regression.  

Since no regressions are allowed between releases, 
it is also being proposed as a blocker for this release.  

Please resolve ASAP.


Note You need to log in before you can comment on or make changes to this bug.