~ubuntu-branches/debian/experimental/gdb/experimental

« back to all changes in this revision

Viewing changes to gdb/testsuite/gdb.base/attach.exp

  • Committer: Package Import Robot
  • Author(s): Hector Oron
  • Date: 2014-11-09 16:29:31 UTC
  • mfrom: (1.2.14)
  • Revision ID: package-import@ubuntu.com-20141109162931-1q6gwbm2lbkap9k3
Tags: 7.8.1-1
* Imported Upstream version 7.8.1
  - GDB 7.8.1 provides the following fixes and improvements over GDB 7.8:
    + PR python/17364 (Need better printer names in bound_registers.py)
    + PR build/17104 (CFLAGS="-Wall -Wextra" gdb/confgure --with-babeltrace
      fails)
    + PR gdb/17345 (babeltrace (1.1.2 and later) complains about the ctf
      data generated by GDB)
    + PR build/17298 (gcore: Couldn't get registers: No such process)
    + PR python/17342 (Xmethod Python is not Python 3 compatible)
    + PR python/17355 (Crash on Python frame filters with unreadable arg)
    + PR guile/17367 (computation of guild path wrong when pkg-config script
      supplied as arg to --with-guile)
    + PR gdb/17247 (gdb freezes on multi threaded app)
    + PR gdb/17347 (Regression: GDB stopped on run with attached process)
    + PR gdb/17407 (Regression for Linux vDSO reading)
    + PR server/17457 (aarch64/gdbserver: wrong floating point registers
      display)
    + PR server/17487 (state->dr_control_mirror == 0 failed assertion in
      gdbserver on Windows)
    + PR gdb/17472 (with annotations, input while executing in the foreground
      crashes readline/gdb)
    + PR gdb/17471 (repeating a background command makes it foreground)
    + PR cli/17300 (crash in non-stop mode with continue -a &
      (readline_callback_read_char() called with no handler!))
    + PR python/17372 (python hangs when displaying help())
    + PR python/17408 (../../gdb/infrun.c:5256: internal-error:
      switch_back_to_stepped_thread: Assertion `!schedlock_applies(1)'
      failed.)
  - Fix --batch mode parameter
    (Closes: #763518)
* d/control*:
  - Bump Standars Version stanza, no changes needed.
  - -dbg depends on main binary version.
* d/rules: fix FTBFS caused by dpkg 1.17.17 changes.
  (Closes: #766754)

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    # Start the program running and then wait for a bit, to be sure
71
71
    # that it can be attached to.
72
72
 
73
 
    set testpid [eval exec $binfile &]
74
 
    exec sleep 2
75
 
    if { [istarget "*-*-cygwin*"] } {
76
 
        # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
77
 
        # different due to the way fork/exec works.
78
 
        set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
79
 
    }
 
73
    set testpid [spawn_wait_for_attach $binfile]
80
74
 
81
75
    # Verify that we cannot attach to nonsense.
82
76
 
279
273
   
280
274
    remote_exec build "kill -9 ${testpid}"
281
275
 
282
 
    # Start the program running and then wait for a bit, to be sure
283
 
    # that it can be attached to.
284
 
   
285
 
    set testpid [eval exec $binfile &]
286
 
    exec sleep 2
287
 
    if { [istarget "*-*-cygwin*"] } {
288
 
        # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
289
 
        # different due to the way fork/exec works.
290
 
        set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
291
 
    }
 
276
    set testpid [spawn_wait_for_attach $binfile]
292
277
 
293
278
    # Verify that we can attach to the process, and find its a.out
294
279
    # when we're cd'd to some directory that doesn't contain the
335
320
    global gdb_prompt
336
321
    global binfile2
337
322
    
338
 
    # Start the program running and then wait for a bit, to be sure
339
 
    # that it can be attached to.
340
 
   
341
 
    set testpid [eval exec $binfile2 &]
342
 
    exec sleep 2
343
 
    if { [istarget "*-*-cygwin*"] } {
344
 
        # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
345
 
        # different due to the way fork/exec works.
346
 
        set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
347
 
    }
 
323
    set testpid [spawn_wait_for_attach $binfile2]
348
324
 
349
325
    # Attach
350
326
   
397
373
        return 0
398
374
    }
399
375
 
400
 
    # Start the program running and then wait for a bit, to be sure
401
 
    # that it can be attached to.
402
 
 
403
 
    set testpid [eval exec $binfile &]
404
 
    exec sleep 2
405
 
    if { [istarget "*-*-cygwin*"] } {
406
 
        # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
407
 
        # different due to the way fork/exec works.
408
 
        set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
409
 
    }
 
376
    set testpid [spawn_wait_for_attach $binfile]
410
377
 
411
378
    gdb_exit
412
379
    if $verbose>1 then {
429
396
    remote_exec build "kill -9 ${testpid}"
430
397
}
431
398
 
 
399
# Test ' gdb --pid PID -ex "run" '.  GDB used to have a bug where
 
400
# "run" would run before the attach finished - PR17347.
 
401
 
 
402
proc test_command_line_attach_run {} {
 
403
    global gdb_prompt
 
404
    global binfile
 
405
 
 
406
    if ![isnative] then {
 
407
        unsupported "commandline attach run test"
 
408
        return 0
 
409
    }
 
410
 
 
411
    with_test_prefix "cmdline attach run" {
 
412
        set testpid [spawn_wait_for_attach $binfile]
 
413
 
 
414
        set test "run to prompt"
 
415
        gdb_exit
 
416
 
 
417
        set res [gdb_spawn_with_cmdline_opts \
 
418
                     "-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
 
419
        if { $res != 0} {
 
420
            fail $test
 
421
            return $res
 
422
        }
 
423
        gdb_test_multiple "" $test {
 
424
            -re {Attaching to.*Start it from the beginning\? \(y or n\) } {
 
425
                pass $test
 
426
            }
 
427
        }
 
428
 
 
429
        send_gdb "y\n"
 
430
 
 
431
        set test "run to main"
 
432
        gdb_test_multiple "" $test {
 
433
            -re "Temporary breakpoint .* main .*$gdb_prompt $" {
 
434
                pass $test
 
435
            }
 
436
        }
 
437
 
 
438
        # Get rid of the process
 
439
        remote_exec build "kill -9 ${testpid}"
 
440
    }
 
441
}
432
442
 
433
443
# Start with a fresh gdb
434
444
 
453
463
 
454
464
do_command_attach_tests
455
465
 
 
466
test_command_line_attach_run
 
467
 
456
468
return 0