Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc/rfa] Revsions to gdbint.texinfo
@ 2001-06-15  0:14 Andrew Cagney
  2001-06-15  5:51 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-06-15  0:14 UTC (permalink / raw)
  To: GDB Patches

Hello,

The attatached patch tries to address the most glaring errors in the GDB 
internals document.  More work is always needed.

Structuring hints are welcome.

It includes a section titled ``Memory Management'' and that, in turn 
mentions alloca().

	Andrew
From brobecker@act-europe.fr Fri Jun 15 00:37:00 2001
From: Joel Brobecker <brobecker@act-europe.fr>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Add 2 persons in MAINTAINERS
Date: Fri, 15 Jun 2001 00:37:00 -0000
Message-id: <20010615093709.B10775@act-europe.fr>
X-SW-Source: 2001-06/msg00286.html
Content-length: 349

Hi,

  Paul Hilfinger and I now have Write After Approval priviledges.
I updated the MAINTAINERS file accordingly (a patch is attached).
Here is the ChangeLog.

2001-06-15  Joel Brobecker <brobecker@act-europe.fr>

        * MAINTAINERS: Add Paul Hilfinger and Joel Brobecker to the
        Write After Approval list.

Ok for me to commit?
-- 
Joel
From eirik@hackrat.com Fri Jun 15 01:00:00 2001
From: Eirik Fuller <eirik@hackrat.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [patch] read_command_lines can return freed memory
Date: Fri, 15 Jun 2001 01:00:00 -0000
Message-id: <20010615080029.8484D40014@hackrat.com>
X-SW-Source: 2001-06/msg00287.html
Content-length: 1246

When sourcing a script file with improperly nested control statments,
gdb can store a pointer to freed memory in a cmd_list_element struct,
which can cause subsequent crashes.  One test case is to source this
script file twice:


define	fp
    set $frame = (long *) $arg0
    while $frame[0] > $frame
	printf "%08x: %08x %08x\n", $frame, $frame[0], $frame[1]
	if $frame[1]
	    if ((uchar **)$frame)[1][-5] == 0xe8
		x/i $frame[1] - 5
	    else
		if ((uchar **)$frame)[1][-2] == 0xff
		    x/i $frame[1] - 2
		else
		    x/i $frame[1]
#		end
	    end
	else
	    x/i $frame[2]
	end
	set $frame = (long *) $frame[0]
    end
end


Removing the # results in a script file which can be sourced with no
errors.  The patch included here prevents the crash.  Here's a
ChangeLog entry:

2001-06-15  Eirik Fuller  <eirik@hackrat.com>

	* cli/cli-script.c (read_command_lines): Don't return freed
	memory.

Here's the patch:

--- gdb+dejagnu-20010615/gdb/cli/cli-script.c-	Tue Mar 13 14:29:14 2001
+++ gdb+dejagnu-20010615/gdb/cli/cli-script.c	Thu Jun 14 22:53:17 2001
@@ -995,7 +995,10 @@
 	  discard_cleanups (old_chain);
 	}
       else
-	do_cleanups (old_chain);
+	{
+	  do_cleanups (old_chain);
+	  head = NULL;
+	}
     }
 
   if (readline_end_hook)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfc/rfa] Revsions to gdbint.texinfo
  2001-06-15  0:14 [rfc/rfa] Revsions to gdbint.texinfo Andrew Cagney
@ 2001-06-15  5:51 ` Eli Zaretskii
  2001-06-15  8:15   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2001-06-15  5:51 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

> Date: Fri, 15 Jun 2001 03:14:38 -0400
> From: Andrew Cagney <ac131313@cygnus.com>
> 
> More work is always needed.

I'd say this is the understatement of the year! ;-)

I like these additions and welcome them; thanks!  What follows is
mostly boring minor nitpicking.

> ! The target architecture object is implemented as the C structure
> ! @code{struct gdbarch *}.  The structure, and its methods, are generated
> ! using the Bourn shell script @code{gdbarch.sh}.

gdbarch.sh is a file, so it should have the @file markup.

> + significant change.  Many of the macro's

That's "macros", without the quote.

> + section below are likely to be made obsolete.  See the file @code{TODO}

@file{TODO}.

> + @item gdb/@var{arch}-tdep.c, gdb/@var{arch}-tdep.h

If you need two items in a row, please use @itemx for all but the
first:

  @item gdb/@var{arch}-tdep.c
  @itemx gdb/@var{arch}-tdep.h

> + @subsection Memory Management

This section consistently uses @code{foo()}, with the parentheses, to
designate functions.  The parentheses should be removed, because the
name of the function is just `foo'; `foo()' is a call to that function
with no arguments.

> + et.al. these functions do not return when the memory pool is empty.

You should say "et.al.@:", otherwise TeX will typeset the period as if
it were at the end of a sentence.

> + @value{GDBN} can use the non-portable function for the allocation of
> + small tempoary values (such as strings).

Didn't you meant to mention that function's name, alloca?  Or is it so
bad that even its name shouldn't be pronounced in vain? ;-)

> + @code{sprintf()} are very proned to buffer overflow errors.}

I think "proned" is not correct English.  "prone" is the right usage.

> ! @samp{-Wunused-parameter} is precluded from the list.  The macro
> ! @samp{ATTRIBUTE_UNUSED} is not used as it leads to false negatives ---

ATTRIBUTE_UNUSED should be in @code, not in @samp, since it is not
something you type at some program's prompt.

> ! While in a definition, the function's name must be in column zero; in a
> ! function declaration, the name must be on the same line as the return
> ! type.
>   
> + @example
> + void foo (void);
> + @end example

This should say explicitly that the example shows declaration, not
definition.  Or mayube we should have two examples, one each for each
one of the two cases.

>   @cindex C data types
> + 
>   Code must not depend on the sizes of C data types, the format of the

This is wrong: there should be no blank line between an index entry
and the chunk of text it references.

> + Prototypes must be used when both @emph{declareing} and @emph{defineing}

That's "declaring" and "defining" ;-)

> + @value{GDBN} must not call @samp{abort()}.  Use @samp{internal_error()}.

@code{abort} and @code{internal_error}.

> + @samp{gdb_string.h}) the file name based on the POSIX header prefixed
> + with @samp{gdb_}.

These are file names, so use @file.

> + All debugging code must be controllable using the @samp{set debug
> + <module>} command.  Do not use @samp{printf}s to print trace messages.

Instead of <module> say @var{module}.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfc/rfa] Revsions to gdbint.texinfo
  2001-06-15  5:51 ` Eli Zaretskii
@ 2001-06-15  8:15   ` Andrew Cagney
  2001-06-15  8:33     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-06-15  8:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> gdbarch.sh is a file, so it should have the @file markup

BTW, Is there a texinfo quick reference card (I can staple to my forehead)?

	Andrew

(I'll get to the feedback next).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfc/rfa] Revsions to gdbint.texinfo
  2001-06-15  8:15   ` Andrew Cagney
@ 2001-06-15  8:33     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2001-06-15  8:33 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

> Date: Fri, 15 Jun 2001 10:27:47 -0400
> From: Andrew Cagney <ac131313@cygnus.com>
> 
> BTW, Is there a texinfo quick reference card (I can staple to my forehead)?

Not that I know of.  You can use me as a substitute ;-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-06-15  8:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-15  0:14 [rfc/rfa] Revsions to gdbint.texinfo Andrew Cagney
2001-06-15  5:51 ` Eli Zaretskii
2001-06-15  8:15   ` Andrew Cagney
2001-06-15  8:33     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox