Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/2] Documentation and testcase
Date: Mon, 23 Mar 2015 20:27:00 -0000	[thread overview]
Message-ID: <5510773D.4010107@redhat.com> (raw)
In-Reply-To: <87wq283gmx.fsf@redhat.com>

On 03/22/2015 08:45 PM, Sergio Durigan Junior wrote:

> +# We do not do file-backed mappings in the test program, but it is
> +# important to test this anyway.  One way of performing the test is to
> +# load GDB with a corefile but without a binary, and then ask for the
> +# disassemble of a function (i.e., the binary's .text section).  GDB
> +# should fail in this case.  However, it must succeed if the binary is
> +# provided along with the corefile.  This is what we test here.

It seems like we now just miss the case of corefilter that _does_ request
that the file backed regions are dumped.  In that case, disassembly
should work without the binary.  Could you add that too, please?  We
can e.g., pass a boolean parameter to test_disasm to specify whether
to expect that disassembly works without a program file.

> +
> +proc test_disasm { core address } {
> +    global testfile
> +
> +    # Restarting GDB without loading the binary
> +    gdb_exit
> +    gdb_start
> +
> +    set core_loaded [gdb_core_cmd "$core" "load core"]
> +    if { $core_loaded == -1 } {
> +	fail "loading $core"
> +	return
> +    }
> +
> +    gdb_test "disassemble $address" "No function contains specified address." \
> +	"disassemble function with corefile and without a binary"
> +
> +    clean_restart $testfile
> +
> +    set core_loaded [gdb_core_cmd "$core" "load core"]
> +    if { $core_loaded == -1 } {
> +	fail "loading $core"
> +	return
> +    }
> +
> +    gdb_test "disassemble $address" "Dump of assembler code for function.*" \
> +	"disassemble function with corefile and with a binary"

Looks like there are duplicate test messages here, in the
cases clean_restart, gdb_core_cmd, etc. fail.  You can fix that
with e.g.:

       with_test_prefix "no binary" {
           # Restart GDB without loading the binary.
           gdb_exit
	   gdb_start

	   set core_loaded [gdb_core_cmd "$core" "load core"]
	   if { $core_loaded == -1 } {
	      fail "load $core"
	      return
	   }

	   gdb_test "disassemble $address" "No function contains specified address." \
		"disassemble function"
       }

       with_test_prefix "with binary" {
	   clean_restart $testfile

	   set core_loaded [gdb_core_cmd "$core" "load core"]
	   if { $core_loaded == -1 } {
	      fail "load $core"
	      return
	   }

	   gdb_test "disassemble $address" "No function contains specified address." \
		"disassemble function"
       }

> +# Getting the inferior's PID

"Get".  Period at end.

> +set infpid ""
> +gdb_test_multiple "info inferiors" "getting inferior pid" {
> +    -re "process \($decimal\).*\r\n$gdb_prompt $" {
> +	set infpid $expect_out(1,string)
> +    }
> +}
> +
> +# Get the main function's address

Period.

(I saw a few other similar gerund uses in the file which
read a bit odd to me, but I didn't point them all out.)

This is OK with the missing test added.

Thanks for the patience and for working on this.

Thanks,
Pedro Alves


  reply	other threads:[~2015-03-23 20:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 23:22 [PATCH v4 0/2] Improve corefile generation by using /proc/PID/coredump_filter (PR corefile/16902) Sergio Durigan Junior
2015-03-19 23:22 ` [PATCH 1/2] Implement support for checking /proc/PID/coredump_filter Sergio Durigan Junior
2015-03-20 19:12   ` Pedro Alves
2015-03-20 20:02     ` Sergio Durigan Junior
2015-03-20 22:02       ` Pedro Alves
2015-03-23 18:40         ` Sergio Durigan Junior
2015-03-23 20:36           ` Pedro Alves
2015-03-19 23:22 ` [PATCH 2/2] Documentation and testcase Sergio Durigan Junior
2015-03-20 19:46   ` Pedro Alves
2015-03-20 21:03     ` Sergio Durigan Junior
2015-03-20 22:09       ` Pedro Alves
2015-03-22 20:46         ` Sergio Durigan Junior
2015-03-23 20:27           ` Pedro Alves [this message]
2015-03-23 21:08             ` Sergio Durigan Junior
2015-03-23 23:06               ` Pedro Alves
2015-03-24  6:37                 ` Sergio Durigan Junior
2015-03-24 10:12                   ` Pedro Alves
2015-03-24 23:15                     ` Sergio Durigan Junior
2015-03-24 23:48                       ` Pedro Alves
2015-03-24 23:57 [PATCH v4 0/2] Improve corefile generation by using /proc/PID/coredump_filter (PR corefile/16902) Sergio Durigan Junior
2015-03-24 23:57 ` [PATCH 2/2] Documentation and testcase Sergio Durigan Junior
2015-03-27  9:53   ` Pedro Alves

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=5510773D.4010107@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /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