public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: gdb doesn't work very well with dynamic linked binaries
@ 2000-09-07  1:55 James Cownie
  2000-09-07  3:09 ` Mark Kettenis
  0 siblings, 1 reply; 34+ messages in thread
From: James Cownie @ 2000-09-07  1:55 UTC (permalink / raw)
  To: gdb

Mark Kettenis wrote :-
  I'm not sure whether the debug registers are
  per-thread or per-VM-space in Linux.  I'll probably need to look into
  the kernel source.

To save you the time, they are per-thread, just like all the 
other process' registers.

They are conceptually saved and restored on process scheduling
events (which for linuxthreads is the same thing as thread 
scheduling events, since linuxthreads _are_ processes as far as
the scheduler is concerned). 

The bug I mentioned previously is exactly that they're getting
cleared by the kernel and then not getting restored on return
to user space, leaving them wrong until the next reschedule :-(

-- 
-- Jim
James Cownie
jcownie@etnus.com
Etnus, Inc.
Phone +44 117 9071438

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: Proposal: convert function definitions to prototyped form
@ 2000-06-02  8:40 David Taylor
  2000-06-02 12:10 ` Kevin Buettner
  0 siblings, 1 reply; 34+ messages in thread
From: David Taylor @ 2000-06-02  8:40 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb

    Date: Fri, 2 Jun 2000 00:50:19 -0700
    From: Kevin Buettner <kevinb@cygnus.com>
[...]
	2) ``protoize'' fails to convert functions disabled by ifdefs for
	   the given platform.  OTOH, on some other platform(s), these
	   functions might not be disabled and would be converted.  E.g,
	   in breakpoint.c, on my GNU/Linux/x86 machine, protoize failed
	   to convert create_longjmp_breakpoint() which is protected by an
	   "#ifdef GET_LONGJMP_TARGET".

With any solution, either you're going to have to check the results or
you're going to have to hand convert some of the stuff.  It's a
tradeoff.  From what you say below, your script also requires some
later hand conversions.

Does your script produce substantially less that needs to be hand
converted?

	3) ``protoize'' screws up on PTR types.  E.g, in breakpoint.c, it
	   converted

		static int
		cover_target_enable_exception_callback (arg)
		     PTR arg;

	   to

		static int
		cover_target_enable_exception_callback (__builtin_va_list arg)

I consider this to be a more serious problem than the other complaints
you have.

	4) ``protoize'' does not reformat long argument lists.  The lists
	   end up entirely contained on one line.

So... adopt the same solution for it that you chose to adopt for your
script -- run indent on the output!

    For more information on protoize, see the "Running protoize" page:

	http://gcc.gnu.org/onlinedocs/gcc_2.html#SEC48

    and the "Caveats of using protoize" page:

	http://gcc.gnu.org/onlinedocs/gcc_7.html#SEC135

I've used protoize before with good results.  It was a fairly
substantial project, though not as big as gdb.

    Two of my goals in creating the scripts for the PARAMS purging
    activities was that the scripts should be 1) easy to invoke and 2)
    require no hand editing of the output when done.  I.e, you shouldn't
    have to edit any of the files that these scripts touch in order to fix

I trust that "3)" is:

    "be conservative; not convert something if it can't be sure
    of getting it right".

I'd much rather hand convert more of the code than have it make a
subtle but incorrect change.

    errors so that you can build again.  OTOH, the script may leave
    certain portions of the file alone that could possibly have be
    converted had the script been a little smarter.  The things that the
    script fails to convert *will* have to be fixed later on (in order to
    complete the cleanup activity), either by another script, or by hand. 
    For the PARAMS purging activity, I have spent a fair amount of time
    examining the diffs to make sure that this is indeed the case.  (And
    I intend to do the same for the activity in this proposal.)

Good.

    The reason that it is so important to avoid any hand edits is that we
    want people who have local repositories or checked out source trees to
    be able to run these conversion scripts against them so that merges
    will be less painful.  (Even easy.)

Agreed.

    With that said, keeping in mind the problems I noted above, I conclude
    that ``protoize'' is not the appropriate tool for us to use to convert
    function definitions in the gdb sources to their prototyped form.

I only consider 3) -- screwing up on PTR types -- to be serious; the
others seem minor enough.
[...]

    Finally, I should note that I've done a test build on GNU/Linux/x86
    and had no build problems, nor did I see any regressions when I ran
    the testsuite.

    The fix-decls script is below.  I'd be interested in finding out if
    anyone else has a favorite script for doing this sort of thing.  Other
    comments welcome too.

I'd be tempted to do a build before running your script; stash away the
object files; run the script; do another build; compare the object
files...

I consider the lack of (prototyped) function declarations to be more
serious "problem" than the use of old style function definitions in
old code.  I'd like to see:

. declarations near the top of every file (i.e., before the first
  function definition) for every static function in the file.

. a declaration in an included header file for every non static
  function definition and for every non static function used.

. changes to the default configuration to "encourage" developers to
  include the above declarations.

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

end of thread, other threads:[~2001-03-21 15:59 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-07  1:55 gdb doesn't work very well with dynamic linked binaries James Cownie
2000-09-07  3:09 ` Mark Kettenis
2000-09-07  8:02   ` Eli Zaretskii
2000-09-08  8:30     ` Mark Kettenis
2001-02-10  7:34       ` [RFC] Unified watchpoints for x86 platforms Eli Zaretskii
2001-02-10 10:19         ` H . J . Lu
2001-02-10 11:28           ` Eli Zaretskii
2001-02-15  3:48         ` Eli Zaretskii
2001-02-15  8:17           ` Mark Kettenis
2001-02-15  9:32             ` Eli Zaretskii
2001-02-15 10:33               ` Mark Kettenis
2001-02-15 13:26                 ` Eli Zaretskii
2001-02-15 10:41             ` Kevin Buettner
2001-02-15 13:26               ` Eli Zaretskii
2001-02-15 14:46                 ` J.T. Conklin
2001-02-15 16:11                   ` Kevin Buettner
2001-02-15 23:29                     ` Eli Zaretskii
2001-02-24 10:14                     ` Eli Zaretskii
2001-02-27  3:28                       ` Mark Kettenis
2001-02-27 10:57                         ` Eli Zaretskii
2001-03-21 15:59                         ` [RFA] " Eli Zaretskii
2001-02-15 23:30                   ` [RFC] " Eli Zaretskii
2001-02-16 10:52                     ` J.T. Conklin
2001-02-16  0:00                   ` Mark Kettenis
2001-02-15  9:08           ` H . J . Lu
2000-09-09 14:39   ` gdb doesn't work very well with dynamic linked binaries Peter.Schauer
  -- strict thread matches above, loose matches on Subject: below --
2000-06-02  8:40 Proposal: convert function definitions to prototyped form David Taylor
2000-06-02 12:10 ` Kevin Buettner
2000-06-03  3:58   ` Eli Zaretskii
     [not found]     ` <eliz@delorie.com>
2000-06-03 10:50       ` Kevin Buettner
2000-06-03 11:37         ` Eli Zaretskii
2000-06-03 18:18         ` Andrew Cagney
2000-06-03 15:42       ` Kevin Buettner
2001-02-16  0:45       ` [RFC] Unified watchpoints for x86 platforms Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).