Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files
Date: Wed, 13 Apr 2016 15:16:00 -0000	[thread overview]
Message-ID: <570E62B7.1030409@redhat.com> (raw)
In-Reply-To: <1460489060-17307-3-git-send-email-lgustavo@codesourcery.com>

On 04/12/2016 08:24 PM, Luis Machado wrote:

> - Addressed comments and moved the test to a proc that can be called multiple
> times.
> - The testcase now exercises these permutations:
> 
> * Unreadable file + empty sysroot
> * Unreadable file + target: sysroot
> * Removed file + empty sysroot
> * Removed file + target: sysroot
> 
> With an unpatched GDB we should see this:
> 
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "" action = permission: connection to GDBserver succeeded (the program is no longer running)
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "" action = delete: connection to GDBserver succeeded (the program is no longer running)
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "target:" action = permission: connection to GDBserver succeeded (the program is no longer running)
> FAIL: gdb.server/connect-with-no-symbol-file.exp: test sysroot = "target:" action = delete: connection to GDBserver succeeded (the program is no longer running)
> 
> A patched GDB should have full passes.

Excellent.  LGTM.  A couple minor comments below.

> +
> +#include <stdio.h>
> +
> +int
> +main (int argc, char **argv)
> +{
> +  printf ("Hello world!\n");
> +  return 0;
> +}

No need for stdio.h / printf, right?  As a general principle,
if the test doesn't need those, best just not to compile
them in either.

> +# Make sure we have the original symbol file in a safe place to copy from.
> +gdb_remote_download host $binfile $binfile.bak
> +
> +# Run the test with different permutations.
> +foreach sysroot $sysroots {
> +    foreach action $file_actions {
> +	with_test_prefix "test sysroot = \"$sysroot\" action = $action" {
> +	    connect_no_symbol_file $sysroot $action
> +	}
> +    }
> +}
> 

Note you can simplify using foreach_with_prefix.  No need
for the separate variables then:

foreach_with_prefix sysroot {"" "target:"} {
    foreach_with_prefix action {"permission" "delete"} {
       connect_no_symbol_file $sysroot $action
    }
}

Thanks,
Pedro Alves


  reply	other threads:[~2016-04-13 15:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 19:24 [PATCH v2 0/2] Debugging without a symbol file Luis Machado
2016-04-12 19:24 ` [PATCH v2 2/2] Test GDB connection to GDBserver with no symbol files Luis Machado
2016-04-13 15:16   ` Pedro Alves [this message]
2016-04-13 15:24     ` Luis Machado
2016-04-12 19:24 ` [PATCH v2 1/2] Debugging without a binary (regression) Luis Machado
2016-04-13 15:00   ` Pedro Alves
2016-04-13 15:16     ` Luis Machado

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=570E62B7.1030409@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.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