From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2705 invoked by alias); 1 Jan 2007 01:45:16 -0000 Received: (qmail 2696 invoked by uid 22791); 1 Jan 2007 01:45:15 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 01 Jan 2007 01:45:11 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.13.8/8.13.8) with ESMTP id l011j8Un022202 for ; Mon, 1 Jan 2007 02:45:08 +0100 (CET) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.13.8/8.13.8/Submit) id l011j8FY027694; Mon, 1 Jan 2007 02:45:08 +0100 (CET) Date: Mon, 01 Jan 2007 01:45:00 -0000 Message-Id: <200701010145.l011j8FY027694@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: gdb-patches@sourceware.org Subject: [RFA] Cleanup mi_cmd_data_write_register_values 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 X-SW-Source: 2007-01/txt/msg00001.txt.bz2 The next victim in my vendetta agains deprecated_xxx. Looks like this function pretty was pretty much rolling its own regcache_cooked_write_signed(), so why not use that? ok? Mark Index: ChangeLog from Mark Kettenis * mi/mi-main.c (mi_cmd_data_write_register_values): Use regcache_cooked_write_signed instead of deprecated_write_register_bytes. Index: mi/mi-main.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.86 diff -u -p -r1.86 mi-main.c --- mi/mi-main.c 17 Nov 2006 19:30:41 -0000 1.86 +++ mi/mi-main.c 1 Jan 2007 01:42:23 -0000 @@ -545,10 +545,7 @@ get_register (int regnum, int format) enum mi_cmd_result mi_cmd_data_write_register_values (char *command, char **argv, int argc) { - int regnum; - int i; - int numregs; - LONGEST value; + int numregs, i; char format; /* Note that the test for a valid register must include checking the @@ -587,26 +584,18 @@ mi_cmd_data_write_register_values (char for (i = 1; i < argc; i = i + 2) { - regnum = atoi (argv[i]); + int regnum = atoi (argv[i]); - if (regnum >= 0 - && regnum < numregs - && REGISTER_NAME (regnum) != NULL - && *REGISTER_NAME (regnum) != '\000') + if (regnum >= 0 && regnum < numregs + && REGISTER_NAME (regnum) && *REGISTER_NAME (regnum)) { - void *buffer; - struct cleanup *old_chain; + LONGEST value; - /* Get the value as a number */ + /* Get the value as a number. */ value = parse_and_eval_address (argv[i + 1]); - /* Get the value into an array */ - buffer = xmalloc (DEPRECATED_REGISTER_SIZE); - old_chain = make_cleanup (xfree, buffer); - store_signed_integer (buffer, DEPRECATED_REGISTER_SIZE, value); + /* Write it down */ - deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (regnum), buffer, register_size (current_gdbarch, regnum)); - /* Free the buffer. */ - do_cleanups (old_chain); + regcache_cooked_write_signed (current_regcache, regnum, value); } else {