From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27395 invoked by alias); 18 Jan 2013 16:07:22 -0000 Received: (qmail 27361 invoked by uid 22791); 18 Jan 2013 16:07:20 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from usmamail.tilera.com (HELO USMAMAIL.TILERA.COM) (12.216.194.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Jan 2013 16:07:09 +0000 Received: from [192.168.0.103] (218.11.179.59) by USMAExch2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server (TLS) id 14.0.694.0; Fri, 18 Jan 2013 11:07:07 -0500 Message-ID: <50F97326.3040709@tilera.com> Date: Fri, 18 Jan 2013 16:07:00 -0000 From: Jiong Wang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Joel Brobecker CC: , Walter Lee Subject: Re: [RFC/TileGX 5/6]show registers in columns References: <50F91633.6000704@tilera.com> <20130118135039.GI3564@adacore.com> In-Reply-To: <20130118135039.GI3564@adacore.com> Content-Type: multipart/mixed; boundary="------------020504040304040605060005" 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: 2013-01/txt/msg00437.txt.bz2 --------------020504040304040605060005 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Content-length: 4857 于 2013/1/18 21:50, Joel Brobecker 写道: >> tilegx has 64 registers, to show them in row will be not very >> convinent to explore, >> so we improve this by showing them in columns. >> >> (gdb) info registers >> r0 0x0000000000000001 r19 0x0000000000000000 r38 0x0000000000000040 >> r1 0x000001ffffc7f458 r20 0x000001ffffc7f278 r39 >> 0x0000000000000000 >> r2 0x000001ffffc7f468 r21 0x000001ffffc7f298 r40 >> 0x000000000015b3e8 >> r3 0x0000000000010720 r22 0x000001ffffc7f280 r41 >> 0x000000000015882c > Forgive me, but the above doesn't look easier to read... Was it > because of wrap-around by your mailer or your MTA? yes, I think it's caused by my mailer. please see attachment for the comparision > >> gdb/ChangeLog: >> >> * tilegx-tdep.c (tilegx_print_registers_info): New function. >> show registers in columns. > I am not a big specialist of formatting this type of information. > To me the first 2 obvious remarks is that: > > - The number of columns should be dynamic, depending on the width > of the terminal; and if the width is unset, then default to > 80 characters. We may also have to make a decision if the width > is unlimited. > > - This will need confirmation from the other Global Maintainers > but I think it would be better if you used the ui-out routines > to print the registers. > > One additional remark is that, with 64 registers, it might be good > enough to print them in two columns always, and not deal with > complexity of the terminal width. It even looks like you might be > able to fit in 3 columns within 80 chars, if you prefer... thanks for your good suggestion. yes, 3 columns still be within 80 chars. and by display in 3 columns, it is with larger probability that the user do not need to scroll down and up his mouse to view the results. by 2 columns, the list is still a bit long, and the information is not that centered. So, is this patch OK? > > >> please review. >> >> --- >> Regards, >> Jiong >> Tilera Corporation. >> >> --- >> gdb/tilegx-tdep.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 files changed, 63 insertions(+) >> >> diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c >> index 7f36bed..c19bdf9 100644 >> --- a/gdb/tilegx-tdep.c >> +++ b/gdb/tilegx-tdep.c >> @@ -940,6 +940,66 @@ tilegx_cannot_reference_register (struct gdbarch *gdbarch, int regno) >> return 1; >> } >> >> + >> +/* Tilera private register printer. */ >> +#define MAX_COLUMNS 3 >> +static void >> +tilegx_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, >> + struct frame_info *frame, >> + int regnum, int print_all) >> +{ >> + int i; >> + int j; >> + int k; >> + gdb_byte buffer[MAX_REGISTER_SIZE]; >> + >> + if (regnum != -1) >> + { >> + default_print_registers_info (gdbarch, file, frame, regnum, print_all); >> + return; >> + } >> + >> + for (i = 0; i < TILEGX_NUM_EASY_REGS / MAX_COLUMNS + 1; ++i) >> + { >> + for (j = i; >> + j < TILEGX_NUM_EASY_REGS + 1; >> + j += TILEGX_NUM_EASY_REGS / MAX_COLUMNS + 1) >> + { >> + /* Some registers are never available. Skip them and print PC. */ >> + if (j > TILEGX_LR_REGNUM) >> + j = TILEGX_PC_REGNUM; >> + >> + if (j > i) >> + fprintf_filtered (file, " "); >> + >> + fputs_filtered (gdbarch_register_name (gdbarch, j), file); >> + print_spaces_filtered (5 - strlen (gdbarch_register_name >> + (gdbarch, j)), file); >> + >> + /* Get the data in raw format. */ >> + if (! deprecated_frame_register_read (frame, j, buffer)) >> + { >> + fprintf_filtered (file, " *** no value *** "); >> + } >> + else >> + { >> + fprintf_filtered (file, "0x"); >> + for (k = 0; k < tilegx_reg_size; k++) >> + { >> + int idx; >> + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) >> + idx = k; >> + else >> + idx = tilegx_reg_size - 1 - k; >> + fprintf_filtered (file, "%02x", (unsigned char) buffer[idx]); >> + } >> + } >> + } >> + >> + fprintf_filtered (file, "\n"); >> + } >> +} >> + >> static struct gdbarch * >> tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) >> { >> @@ -1000,6 +1060,9 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) >> /* Stack grows down. */ >> set_gdbarch_inner_than (gdbarch, core_addr_lessthan); >> >> + /* Tilera private register printer */ >> + set_gdbarch_print_registers_info (gdbarch, tilegx_print_registers_info); >> + >> /* Frame Info. */ >> set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp); >> set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc); >> -- >> 1.7.10.3 >> >> > --------------020504040304040605060005 Content-Type: application/octet-stream; name="display-compare.tar.bz2" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="display-compare.tar.bz2" Content-length: 1708 QlpoOTFBWSZTWfFpFV0ABu3/lP38AQBEf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