From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by sourceware.org (Postfix) with ESMTPS id 15B1B3857C46 for ; Fri, 9 Oct 2020 06:06:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 15B1B3857C46 Received: by mail-wr1-f48.google.com with SMTP id y12so3580298wrp.6 for ; Thu, 08 Oct 2020 23:06:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2CfbwA3Qci38lP4YC0WT4lMzF4NBsfvA6r1NtuhUuAY=; b=PVooArJsjXre3Ocdn3JXbRJ0uKMIXh0aYA2s+eWIJ9LhZvlMSKt7sVdVW7TteBFcGA rwsdQiITAh2zhnPNYyhaRvzOyYF6bDfGEtzQqLl1hKMJuWxf6Q2aUv/ZrIfXQnN/EAzZ Tqt6wXxE8dxOKede2VPt0GYhHdH5sC3DD+I2wov4FxRdrJ4suEbXjbh4a96g7F0mj38u Az22JXi2AWHS6tofO9AYyq/CRAHs1/5G6wMvA3m0OK+wqQsXr0fwqGdYIznIIduUrKGT BF1ZQIM9cNEI0h7nLGBBIfNr7CoucIkdTPZgz7CpyMQI4btiXHpc07/pHChaOYETZnJD LSkw== X-Gm-Message-State: AOAM5322thlfRe5ap04p46PkUHmqFCQmXNhKLcZvVdWRpbKqy5CHCTYK IIykRJ+Rx2bq4wjEsngs1BXmpbIG5/5NjQ== X-Google-Smtp-Source: ABdhPJy507ldejkVx2Bunxd+NBmg8TDqzQj/jp9tr5qYaUY8nJ7ZqlI+9T5ZPepIX7ym56UjLfoRYg== X-Received: by 2002:a5d:5602:: with SMTP id l2mr13759373wrv.410.1602223598879; Thu, 08 Oct 2020 23:06:38 -0700 (PDT) Received: from localhost ([2a02:c7d:d65a:4200:2236:f008:480a:c873]) by smtp.gmail.com with ESMTPSA id v128sm9906428wme.2.2020.10.08.23.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 23:06:37 -0700 (PDT) From: Jan Vrany To: gdb-patches@sourceware.org Cc: Jan Vrany Subject: [pushed] Notify observers that directories have changed when using "directory" CLI command Date: Fri, 9 Oct 2020 07:06:23 +0100 Message-Id: <20201009060623.228231-1-jan.vrany@labware.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2020 06:06:41 -0000 gdb/ChangeLog * source.c (directory_command): Notify observers that "directories" parameter has changed. gdb/testsuite/ChangeLog * gdb.mi/mi-cmd-param-changed.exp: Check that notification is is emmited for both 'set directories' and 'directory' commands. --- gdb/ChangeLog | 5 +++++ gdb/source.c | 11 +++++++++-- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp | 11 +++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cba2c27c0e..4927c895fa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-10-09 Jan Vrany + + * source.c (directory_command): Notify observers that "directories" + parameter has changed. + 2020-10-08 Tom Tromey * cli/cli-cmds.c (print_disassembly): Style function name and diff --git a/gdb/source.c b/gdb/source.c index 0c2b5a4f83..a73a31f644 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -446,6 +446,7 @@ init_source_path (void) static void directory_command (const char *dirname, int from_tty) { + bool value_changed = false; dont_repeat (); /* FIXME, this goes to "delete dir"... */ if (dirname == 0) @@ -454,15 +455,21 @@ directory_command (const char *dirname, int from_tty) { xfree (source_path); init_source_path (); + value_changed = true; } } else { mod_path (dirname, &source_path); forget_cached_source_info (); + value_changed = true; + } + if (value_changed) + { + gdb::observers::command_param_changed.notify ("directories", source_path); + if (from_tty) + show_directories_1 ((char *) 0, from_tty); } - if (from_tty) - show_directories_1 ((char *) 0, from_tty); } /* Add a path given with the -d command line switch. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 075fe2ff5a..3d88199c63 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-10-09 Jan Vrany + + * gdb.mi/mi-cmd-param-changed.exp: Check that notification is + is emmited for both 'set directories' and 'directory' commands. + 2020-10-08 Tom Tromey * gdb.base/style.exp: Check that "main"'s name is styled. diff --git a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp index 031d396dba..2d653c0e80 100644 --- a/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-cmd-param-changed.exp @@ -102,6 +102,17 @@ proc test_command_param_changed { } { ".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \ "\"set ch type on\"" + # Notification is emitted for both 'set directories' and 'directory'. + mi_gdb_test "set directories \$cdir:\$cwd:/tmp" \ + ".*=cmd-param-changed,param=\"directories\",value=\".*\".*\\^done" \ + "\"set directories \$cdir:\$cwd:/tmp\"" + mi_gdb_test "directory /usr/src/gdb" \ + ".*=cmd-param-changed,param=\"directories\",value=\".*\".*\\^done" \ + "\"directory /usr/src/gdb\"" + mi_gdb_test "directory" \ + ".*=cmd-param-changed,param=\"directories\",value=\".*\".*\\^done" \ + "\"directory\"" + mi_gdb_exit } } -- 2.28.0