From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53375 invoked by alias); 28 Apr 2018 01:19:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 53334 invoked by uid 89); 28 Apr 2018 01:19:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*F:D*in X-HELO: mail-wm0-f67.google.com Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 28 Apr 2018 01:19:45 +0000 Received: by mail-wm0-f67.google.com with SMTP id i3so5668601wmf.3 for ; Fri, 27 Apr 2018 18:19:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=qSECZ9xOH1OHkKmW70L8FFVmqwkHXsCjELaK2RwDbEE=; b=r0dHLBPqSu0EZ2ofZlWG+Ujn3xbk1ta0RSvvIACoLx0I30qxVonWCQAGZEQ5fhgWhh aXjWq4wN6A2+Icm/BaLiM3rTrWTeTWnxIUDJbGl1tCs/i+htXZpaSZA6Nbmq6Vr+FL5h HHcFxev9OD29xzVONZwRJ0G0+N9jR/UA/Z/59PbqvA8SeEpO3dOVdYNxaZYMScAWjSA/ eCi98Xh6gEjrFnqWNIdGsqRbChsrNPEHWXkLP/ZFAY3Q04+mjwF4T+nmUjo5b+o/t4Tm aGRaPqHFewZg/F5pNE+fsPNcQoNA/03JjpdlUj8RAWNZE7AFfyjxvR024woVdmmbB8Mh xgIQ== X-Gm-Message-State: ALQs6tDjpzAzbRVT90d3+1T5sRInz7a20xpuiziuYd6Qj7W9lfkZ8A9U bxoDMT0PwwZb8Cz921nqxwyEZu0K X-Google-Smtp-Source: AB8JxZrpCXFTF7nFuilyQM1LI6SltFd2OSPt0rvS3CzVPD3Nro2SuVVJ7TKAUj9MAL7XjtncusFSzQ== X-Received: by 10.28.213.198 with SMTP id m189mr2672670wmg.28.1524878383081; Fri, 27 Apr 2018 18:19:43 -0700 (PDT) Received: from localhost.localdomain (243-213-190-109.dsl.ovh.fr. [109.190.213.243]) by smtp.gmail.com with ESMTPSA id b13sm2570379wmi.42.2018.04.27.18.19.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Apr 2018 18:19:42 -0700 (PDT) From: Julio Guerra X-Google-Original-From: Julio Guerra To: gdb-patches@sourceware.org Cc: Mike Frysinger Subject: [PATCH 1/4] Remove the restriction of File I/O functions to regular files only Date: Sat, 28 Apr 2018 01:19:00 -0000 Message-Id: <20180428011940.115515-2-julio@farjump.io> In-Reply-To: <20180428011940.115515-1-julio@farjump.io> References: <20180428011940.115515-1-julio@farjump.io> X-SW-Source: 2018-04/txt/msg00587.txt.bz2 The major goal is being able to write advanced embedded testing functions, like: - reading/writing to a dedicated fifo between the embedded program and the host, instead of using the GDB console only. - mocking features based on host's. Tested with https://github.com/farjump/raspberry-pi/blob/ea31c48d7c7eed27d39fb1bec2d3a1d308cb8ae7/src/semihosting/semihosting.c Also answers to an old RFC I did on the ML: https://sourceware.org/ml/gdb/2016-07/msg00003.html 2018-04-28 Julio Guerra * gdb/remote-fileio.c: allow using File I/O functions with special files. Signed-off-by: Julio Guerra --- gdb/ChangeLog | 5 +++++ gdb/remote-fileio.c | 24 ------------------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 55e640581a..a9ddac5f98 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-04-28 Julio Guerra + + * gdb/remote-fileio.c: allow using File I/O functions with special + files. + 2018-04-27 Alexandre Oliva * compile/compile-c-types.c (convert_int, convert_float): diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 4c648a9c83..fa3cb15033 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -407,24 +407,6 @@ remote_fileio_func_open (char *buf) return; } - /* Check if pathname exists and is not a regular file or directory. If so, - return an appropriate error code. Same for trying to open directories - for writing. */ - if (!stat (pathname, &st)) - { - if (!S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode)) - { - remote_fileio_reply (-1, FILEIO_ENODEV); - return; - } - if (S_ISDIR (st.st_mode) - && ((flags & O_WRONLY) == O_WRONLY || (flags & O_RDWR) == O_RDWR)) - { - remote_fileio_reply (-1, FILEIO_EISDIR); - return; - } - } - fd = gdb_open_cloexec (pathname, flags, mode); if (fd < 0) { @@ -885,12 +867,6 @@ remote_fileio_func_stat (char *buf) remote_fileio_return_errno (-1); return; } - /* Only operate on regular files and directories. */ - if (!ret && !S_ISREG (st.st_mode) && !S_ISDIR (st.st_mode)) - { - remote_fileio_reply (-1, FILEIO_EACCES); - return; - } if (statptr) { host_to_fileio_stat (&st, &fst); -- 2.17.0