Package: gdb
Version: 6.8-3
Severity: normal

NOTE: I encountered what is possibly a second bug while assembling 
this bug report.  If the scripts are run as presented below, gdb 
segfaults.  It fails as describled below if the gdb commands are
entered manually.

This does not work as expected (stops at i==0 rather than i == 4):

#!/bin/sh
cat <<EOF1 >bug.cc
#include <vector>

int main()
{
  int array[] = { 1, 1, 1, 1, 2 };
  std::vector<int> vect( 5, 1 );
  int i, j;
  for (i = 0; i < 5; ++i)
    j = array[i] + vect[i];
  return j;
}
EOF1
g++ -g bug.cc -o bug
gdb bug <<CMDS1
b 9
condition 1 array[i] != vect[i]
r
p i
CMDS1
# END SCRIPT

Further, if I insert a single blank line, GDB crashes rather than
failing to correctly evaluate the condition:

#!/bin/sh
cat <<EOF2 >bug.cc
#include <vector>

int main()
{

  int array[] = { 1, 1, 1, 1, 2 };
  std::vector<int> vect( 5, 1 );
  int i, j;
  for (i = 0; i < 5; ++i)
    j = array[i] + vect[i];
  return j;
}
EOF2
g++ -g bug.cc -o bug
gdb bug <<CMDS2
b 10
condition 1 array[i] != vect[i]
r
p i
CMDS2
# END SCRIPT



-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-perfctr35.0 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gdb depends on:
ii  libc6                     2.7-13         GNU C Library: Shared libraries
ii  libexpat1                 2.0.1-4        XML parsing C library - runtime li
ii  libncurses5               5.6+20080830-1 shared libraries for terminal hand
ii  libreadline5              5.2-3          GNU readline and history libraries

gdb recommends no packages.

Versions of packages gdb suggests:
pn  gdb-doc                       <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to