From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9192 invoked by alias); 7 Jun 2008 20:43:15 -0000 Received: (qmail 9183 invoked by uid 22791); 7 Jun 2008 20:43:14 -0000 X-Spam-Check-By: sourceware.org Received: from mtaout7.012.net.il (HELO mtaout7.012.net.il) (84.95.2.19) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 07 Jun 2008 20:42:47 +0000 Received: from HOME-C4E4A596F7 ([80.230.28.131]) by i-mtaout7.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0K2400A3S0RDOX40@i-mtaout7.012.net.il> for gdb-patches@sourceware.org; Sat, 07 Jun 2008 23:26:02 +0300 (IDT) Date: Sat, 07 Jun 2008 20:43:00 -0000 From: Eli Zaretskii Subject: Re: [patch] Disable child VMA randomizations In-reply-to: <20080607195343.GA10039@host0.dyn.jankratochvil.net> X-012-Sender: halo1@inter.net.il To: Jan Kratochvil Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: References: <20080607195343.GA10039@host0.dyn.jankratochvil.net> X-IsSubscribed: yes 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: 2008-06/txt/msg00129.txt.bz2 > Date: Sat, 7 Jun 2008 21:53:43 +0200 > From: Jan Kratochvil > > the processes map their addresses randomly by default. It can make the > debugging inconvenient as varous addresses are different on each run. > > This feature was suggested by Jakub Jelinek. One can also already wrap whole > GDB by a script calling: setarch `uname -m` -R Thanks. I have a few comments. > +static void > +show_disable_randomization (struct ui_file *file, int from_tty, > + struct cmd_list_element *c, const char *value) > +{ > + fprintf_filtered (file, _("\ > +Whether we disable the randomization of the virtual address space of\n\ > +a spawned child is %s.\n"), > + value); That longish sentence could be made both shorter and more clear. How about this one: "Disabling randomization of debuggee's virtual address space is %s." > + add_setshow_boolean_cmd ("disable-randomization", class_support, > + &disable_randomization, _("\ > +Set mode for inserting breakpoints."), _("\ > +Show mode for inserting breakpoints."), _("\ "breakpoints"? Copy/paste error, right? > +When this mode is on (which is the default), the randomization of\n\ > +the virtual address space is disabled (turns on ADDR_NO_RANDOMIZE).\n\ ^^^^^^^^^^^^^^^^^^^^^^^^^^ What is this supposed to tell Joe Random Hacker who uses GDB to debug his/her program? What is ADDR_NO_RANDOMIZE? > +Standalone programs run with the randomization enabled by default."), On some platforms, right? > While the addresses > +get assigned differently on each run some subtle bugs may be reproducible only > +with specially assigned addresses possibly not reachable with the default > +setting of @kbd{set disable-randomization on}. Can you explain this sentence? I'd like to suggest a better wording, but I can't do that unless I understand what is it that you are trying to say here. > +PIE executables (type @code{ET_DYN}, compiled by @code{gcc -fPIE -pie}) have > +randomized everything - the executable base address, shared libraries base > +address (their prelinking is ignored), mmap areas, stack and heap. Regular > +executables (type @code{ET_EXEC}) do not have randomized their base address, > +shared libraries base address is ranomized only for non-prelinked libraries, > +mmap, stack and heap are still randomized. There's too much unexplained technical details here, so much so that this paragraph sounds like it was meant only for the initiated. What are ET_DYN and ET_EXEC types? why is prelinking relevant? etc. Again, please explain what you are trying to say here, and why it might be useful for readers of the manual, and I will suggest an alternative wording. There are also Texinfo problems in the above: the GCC command should have the @command markup, not @code; use 3 dashes in a row, as in "---", to produce a dash, rather than a minus sign, in the manual; and "ranomized" is a typo. Other than that, the patch for the manual is okay. Thanks.