From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65213 invoked by alias); 5 Sep 2016 10:59:46 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 65191 invoked by uid 89); 5 Sep 2016 10:59:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_40,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=begun, Hx-languages-length:1625, HX-HELO:sk:NAM03-B, one X-HELO: NAM03-BY2-obe.outbound.protection.outlook.com Received: from mail-by2nam03on0066.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) (104.47.42.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Sep 2016 10:59:35 +0000 Received: from CY1PR0501MB1178.namprd05.prod.outlook.com (10.160.145.14) by CY1PR0501MB1180.namprd05.prod.outlook.com (10.160.145.141) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.3; Mon, 5 Sep 2016 10:59:33 +0000 Received: from CY1PR0501MB1178.namprd05.prod.outlook.com ([10.160.145.14]) by CY1PR0501MB1178.namprd05.prod.outlook.com ([10.160.145.14]) with mapi id 15.01.0609.013; Mon, 5 Sep 2016 10:59:32 +0000 From: Paul Marquess To: David Niklas , "gdb@sourceware.org" Subject: RE: collecting data from a coring process Date: Mon, 05 Sep 2016 10:59:00 -0000 Message-ID: References: <20160831151611.1411e3f7@ulgy_thing> In-Reply-To: <20160831151611.1411e3f7@ulgy_thing> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Paul.Marquess@owmobility.com; x-ms-office365-filtering-correlation-id: e0235026-7540-493c-f1f5-08d3d57bb7a7 x-microsoft-exchange-diagnostics: 1;CY1PR0501MB1180;6:O9FYLXKESaJQEQZvCtHdzucCChnPrOQOXHNDgvuK6iSxcDPOIQC2J7hdy8dHHFv87AtZJrpWciEQb6oogp9e8ETUKVKqdUjUHvVvvEmJUXAUNyDg/Mbhcf+7SHCOJICbdzIk9cjN8lpVFSLm+PA0NrukpVRihO9W+I2N3yMEFPOihv6+Sx1aYFMU4gsqA6w6kgWJ36tQPCLGZ6DQ9lp/cgu/BqWvGqpdgRtijNE9ArYklYkTp+5KyyPCh5iW03QoFUuljizqjZpgL7S/RRBYW1T9jRZ/3VR+E073sba3uJU=;5:QSpJzGc7aH6/evFmWPlij7ao7TrjwBufBzQQvtdK5JBAIlbp1D1FPaEdVdqgO7d6aqQ29+QAex3fhiV0kgQxcMoCUA93hSVbPO5735CAQwq3jHAAH82Kli+bDaNIQQL44CgqobCREBRqRQSmqRpkJA==;24:OHYElFvLcRZNMVcN61UeYldtg2pQxv007K4LIZNZ6ML7tO7rxOh1EZgRJmmj+O4+4+elh8oDNQZMpBBnTtfX8TGFsfSG5LY7QLEYio9gn4s=;7:GoAT9txA8PQX3Axuk7XUBP7aZ08u49OApeC3VlgzC3dZHHvQccQMolZ1B+EZW77WagDeFbi3aqHxAFk6SMLWAATxUITxCM8zbXx9CV7iDsU8zbJt650W7JWlP4P0zohXWLi9eziHAyy1mDf26JQOb1wXeInd8/az+wQthA+aifGiFrh0tWzk4qCT0kTABn9W5CDiNW9D/IIntZmEhxWktvalvVtLtY0MG+SpN7Dfv0yR4B2Mk/e1yRtSuNVmA4bE x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0501MB1180; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158362468548515); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:CY1PR0501MB1180;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0501MB1180; x-forefront-prvs: 005671E15D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(199003)(189002)(66066001)(3280700002)(2906002)(3660700001)(76576001)(122556002)(5660300001)(87936001)(77096005)(33656002)(5002640100001)(97736004)(5001770100001)(106356001)(189998001)(107886002)(10400500002)(101416001)(3846002)(92566002)(102836003)(6116002)(2501003)(86362001)(2900100001)(2950100001)(19580395003)(19580405001)(99286002)(105586002)(7736002)(54356999)(76176999)(50986999)(305945005)(74316002)(68736007)(8936002)(7846002)(81156014)(9686002)(81166006)(8666005)(8676002)(7696003)(586003)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0501MB1180;H:CY1PR0501MB1178.namprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: owmobility.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: owmobility.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Sep 2016 10:59:32.4891 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 042bf9d6-5c89-4240-a963-35f806e16660 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0501MB1180 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00021.txt.bz2 From: David Niklas [mailto:doark@mail.com]=20 =20 ... > > > 1) Why not dump the information that you are looking for into a file= =20 > > > in the process signal handler ? > >=20 > > Would love to, but I have no idea what state the process is in once=20 > > the SEGV has been triggered. Just taking pointes as an example, once=20 > > in the signal handler I'm in a situation where I can't trust that any=20 > > pointer contains a valid value. A quick search suggests I can guard=20 > > against that by using a signal handler. But I'm already in one! If=20 > > there is some prior art that shows how to safely dump data from a=20 > > process once a SEGV has been triggered it would make my day. > > >=20 > Oh, oh, I know how to do this (finally a chance to be of use on gdb's mai= ling list :) Ok, assuming that you know what variables you can access or th= at you can stick them in a struct what you do is enter the signal handler (= hear after known as SH), printing the values one by one.=20 Can do that for a very limited sub-set of the data I'm dumping, but in gene= ral there is just too much data to remember that way. > When one of the values causes a SEGV then you reenter SH which checks an = atomic type to see if your in SH and if so then another atomic type to see = if you've begun to print the values. > > If so then a new branch is executed and what gets printed is an inaccessi= ble error value. > Control returns to the first SH and it continues iterating. Interesting technique for dealing with recursive signals. Paul P.S. Sorry for the delay in following up. Had no internet access for about = 10 days.