Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Randolph Chung <randolph@tausq.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch/RFA] multiarch INSTRUCTION_NULLIFIED
Date: Fri, 03 Dec 2004 21:58:00 -0000	[thread overview]
Message-ID: <41B0D61E.8090907@gnu.org> (raw)
In-Reply-To: <20041203201903.GI6359@tausq.org>

Randolph Chung wrote:

Just some nits, fix that, and assuming daniel doesn't notice anything 
(for a day or til monday?), commit it.

> +gdb_breakpoint foo
> +gdb_test "run" ".*Breakpoint 1, .* in foo.*" "Breakpoint at foo"

The leading .* in the pattern you've picked up from the existing code 
isn't actually needed (well at least I'm 99% certain of this as I've 
been stripping them out my self and it makes things more efficient) (the 
trailing .*s are needed :-):

> +  -re ".*in foo.*$gdb_prompt $" {

ditto here and for others.  Can you strip them out and check things are 
ok (i'd do it incrementally first :-).

> +    send_gdb "stepi\n"

Good one ...

> +    exp_continue -continue_timer

I can never remember to do this :-(

> +  }
> +  -re ".*in bar.*$gdb_prompt $" {
> +    fail "stepped into bar"

The pass / fail messages should all be identical (except perhaps for a 
fail where a trailing comment in paren can be added).  So:

	fail "$test (stepped into bar)"

> +  }
> +  -re ".*in main.*$gdb_prompt $" {
> +    pass "stepped into main"

and just:

	pass "$test"

check for the same problem elsewhere.

> +  gdb_test_multiple "print $sym" "Get address of $sym" {
> +    -re ".*($hex) <$sym>.*$gdb_prompt $" {
> +      set addr $expect_out(1,string)
> +      pass "got address of $sym = $addr"
> +    }
> +  }

Remove the address from the test result (I'm always being slapped for 
doing that one ;-).  It can make the comparison of subsequent runs, or 
runs on different systems, harder.

> +  return $addr
> +}
> +
> +if { ! [ runto_main ] } then { gdb_suppress_tests; }
> +
> +set foo [get_addr_of_sym "foo"]
> +set bar [get_addr_of_sym "bar"]
> +set foo_last [expr $bar - 4]
> +
> +gdb_breakpoint "*$foo_last"
> +
> +gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*"
> +gdb_test "backtrace" ".*in foo.*in main.*" "Backtrace from last insn in foo"
> +gdb_test "stepi" ".*in foo.*" "stepi to nullified instruction stays in foo"
> +gdb_test "backtrace" ".*in foo.*in main.*" "Backtrace from nullified insn"
> +gdb_test "stepi" ".*in main.*" "stepi to main"
> +
> +# In the third test, we verify that backtraces from nullified instructions
> +# work even in coredumps
> +
> +proc gen_core { test } {
> +  global gcorefile
> +  global gdb_prompt
> +  set gcore_works 0
> +  set escapedfilename [string_to_regexp $gcorefile]
> +
> +  gdb_test_multiple "gcore $gcorefile" "gcore" {
> +    -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
> +      pass "$test: gcore"
> +      set gcore_works 1
> +    }
> +    -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
> +      unsupported "gcore"
> +    }
> +  }

I'd kfail this.  Not supporting gcore is a bug.

If, on your system, gcore doesn't work then it might be better to steal 
code from bigcore.exp that uses SIGABRT to generate the core file.  Your 
call though.

Anyway, given the follow-on code, I guess it's working for you.

Finally, as a quick sanity check, can you take the gdb.sum output from 
just this test and check it for duplicate test names (sort < gdb.sum | 
uniq -d).  They should be unique.

Thanks!

Andrew


  reply	other threads:[~2004-12-03 21:54 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-18  0:02 Randolph Chung
2004-11-18 14:26 ` Andrew Cagney
2004-11-18 16:21   ` Randolph Chung
2004-11-18 16:56     ` Mark Kettenis
2004-11-19  9:25       ` Orjan Friberg
2004-11-23 17:50       ` Randolph Chung
2004-11-23 19:33         ` Mark Kettenis
2004-11-28 17:26         ` Andrew Cagney
2004-11-28 18:41           ` Randolph Chung
2004-11-28 19:55             ` Andrew Cagney
2004-11-29  3:30               ` Randolph Chung
2004-11-29 15:12                 ` Andrew Cagney
2004-11-30  6:56                   ` Randolph Chung
2004-11-30 14:51                     ` Andrew Cagney
2004-11-30 16:44                       ` Randolph Chung
2004-11-30 16:59                         ` Andrew Cagney
2004-11-30 17:38                           ` Randolph Chung
2004-12-01 21:29                             ` Andrew Cagney
2004-12-01 22:33                               ` Randolph Chung
2004-12-01 23:32                                 ` Andrew Cagney
2004-12-02  5:24                                   ` Randolph Chung
2004-12-02 14:27                                     ` Daniel Jacobowitz
2004-12-03 18:11                                     ` Andrew Cagney
2004-12-03 18:15                                       ` Randolph Chung
2004-12-03 18:57                                         ` Daniel Jacobowitz
2004-12-03 19:57                                           ` Randolph Chung
2004-12-03 21:40                                       ` Randolph Chung
2004-12-03 21:58                                         ` Andrew Cagney [this message]
2004-12-03 22:52                                           ` Daniel Jacobowitz
2004-12-04  0:00                                           ` Randolph Chung
2004-12-04  0:55                                           ` Randolph Chung
2004-12-04 11:27                                             ` Mark Kettenis
2004-12-01  6:19                   ` Randolph Chung
2004-12-01 17:11                     ` Daniel Jacobowitz
2004-12-01 17:17                       ` Randolph Chung
2004-12-01 17:19                         ` Daniel Jacobowitz
2004-12-01 17:25                           ` Randolph Chung
2004-12-01 17:28                             ` Daniel Jacobowitz
2004-12-01 17:30                               ` Randolph Chung
2004-12-01 17:35                               ` Randolph Chung
2004-12-01 18:14                                 ` Randolph Chung
2004-12-01 21:25                       ` Andrew Cagney
2004-12-01 13:32 Paul Schlie
2004-12-01 16:25 Randolph Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41B0D61E.8090907@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox