Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Russell Shaw <rjshaw@netspace.net.au>
Cc: gdb@sourceware.org
Subject: Re: Gdb
Date: Fri, 27 Oct 2006 03:29:00 -0000	[thread overview]
Message-ID: <45417D0E.2040508@netspace.net.au> (raw)
In-Reply-To: <m3bqnydexb.fsf@codesourcery.com>

Jim Blandy wrote:
> Russell Shaw <rjshaw@netspace.net.au> writes:
> 
>>After narrowing down a bug location in the last few days, it seems
>>all too obvious that gdb needs to be gutted and recast. It can all
>>be made simpler and more understandable, thus easier to maintain.
> 
> I think you should give it a shot.  I'd love to see a proper set of
> libraries for controlling processes and interpreting debugging
> information.  You may want to look at Frysk, which is a newer design
> taking a very different approach, but addressing many of the same
> kinds of problems that GDB tries to.
> 
> I've come to think that trying to do involved symbolic processing
> (types; scoping; overload resolution; and multiply by ten where C++ is
> involved) without garbage collection is like trying to build a pocket
> watch out of sawdust and superglue.  Frysk is written in Java.

I didn't know about Frysk. The problem is it's in Java, and java is too indirect
and resource consuming for me.

I made a scoped hierarchial automatic garbage collecting system for C where if
you created an object on the heap between these (possibly nested) macros:

   auto_scope

     AnObject *myobject = mem_new(anoldobject, AnObject);
     ...
     auto_ret(ret_result);
   end_auto
   ...
   return another_result


then any objects within the scope is automatically freed after endauto or auto_ret
if they aren't "owned" by another object outside the scope such as anoldobject.
It works for arbitraryly deep scope, and across long-jumps. A global tree of object
ownerships is maintained, so if a parent of an object is mem_freed() that has other
parents, then the object is not freed() until it has no more parents (an automatic
version of refcounts). You can also modify the scope level of objects, which is
something that is normally unmodifiable in other languages.

After getting it working, i found it slowed the code by 5-10 times and used quite a
bit of memory, because new memory-tracking objects were being used for every small
mem_malloc i did, which were very frequent (thousands per second). It's best to use
this sought of thing for tracking larger (eg, 64-byte) less frequently created objects.

I found later another hierarchial memory manager called Talloc used in Samba.
Haven't used it though. It didn't do as much as i wanted.

I'm still wondering if something like the more manual but faster cleanup chains of
gdb would be a good way of doing things.

> But I would also say that what you've written here looks to me like a
> pretty common reaction of people who've had good experiences writing
> their own code to unfamiliar and complex programs; and at least in my
> own experience, it often mellows as one works with the code more.

Hi,
I've got a closer idea of what/where the problem is now, after looking
through 2k lines of back-traces at various stages during "run" from
delete_breakpoint().

A thing i didn't like is that eg, solib_read_symbols() will eventually mess
around with resetting breakpoints 6 frames deeper in the stack. I would have
handled breakpoint readjustments *after* solib_read_symbols(). I don't know
if it is practical without knowing how all paths operate in greater detail
on all systems and targets. Because i know how it works for the current case,
it seems easier to make a minor patch than to rearrange anything.


#0  delete_breakpoint (bpt=0x84ddd58) at breakpoint.c:6750
#1  0x080e57a0 in breakpoint_re_set_one (bint=0x84ddd58) at breakpoint.c:7206
#2  0x0812ad08 in catch_errors (func=0x80e5264 <breakpoint_re_set_one>, func_args=0x84ddd58, 
errstring=0x898d310 "Error in re-setting breakpoint -413:\n", mask=6) at exceptions.c:515

#3  0x080e5825 in breakpoint_re_set () at breakpoint.c:7248
#4  0x0810e6bf in new_symfile_objfile (objfile=0x8bb8ca0, mainline=0, verbo=0) at symfile.c:868
#5  0x0810e9fb in symbol_file_add_with_addrs_or_offsets (abfd=0x8b66108, from_tty=0, 
addrs=0x8b8cf48, offsets=0x0, num_offsets=0, mainline=0, flags=8) at symfile.c:1019

#6  0x0810ea5f in symbol_file_add_from_bfd (abfd=0x8b66108, from_tty=0, addrs=0x8b8cf48, mainline=0, 
flags=8) at symfile.c:1039

#7  0x0810ea98 in symbol_file_add (name=0x8b88c58 "/usr/lib/libXfixes.so.3", from_tty=0, 
addrs=0x8b8cf48, mainline=0, flags=8) at symfile.c:1052

#8  0x08091869 in symbol_add_stub (arg=0x8b88a50) at solib.c:406
#9  0x0812ad08 in catch_errors (func=0x80917a0 <symbol_add_stub>, func_args=0x8b88a50, 
errstring=0x826c0b0 "Error while reading shared library symbols:\n", mask=6) at exceptions.c:515

#10 0x08091916 in solib_read_symbols (so=0x8b88a50, from_tty=0) at solib.c:432
#11 0x08091c95 in solib_add (pattern=0x0, from_tty=0, target=0x8317100, readsyms=1) at solib.c:684
#12 0x0811fc1b in handle_inferior_event (ecs=0xbf8931f4) at infrun.c:2198
#13 0x0811dc52 in wait_for_inferior () at infrun.c:1009
#14 0x0811da7e in proceed (addr=4294967295, siggnal=TARGET_SIGNAL_0, step=0) at infrun.c:827
#15 0x0811a704 in run_command_1 (args=0x0, from_tty=1, tbreak_at_main=0) at infcmd.c:556


  reply	other threads:[~2006-10-27  3:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-25  7:05 Gdb Russell Shaw
2006-10-25 12:49 ` Gdb Daniel Jacobowitz
2006-10-25 13:38   ` Gdb Russell Shaw
2006-10-25 14:17     ` Gdb Daniel Jacobowitz
2006-10-25 16:29       ` Gdb Russell Shaw
2006-10-25 20:16         ` Gdb Eli Zaretskii
2006-10-25 20:08     ` Gdb Eli Zaretskii
2006-10-26  2:28       ` Gdb Russell Shaw
2006-10-26  7:11         ` Gdb Eli Zaretskii
2006-10-26  8:16           ` Gdb Russell Shaw
2006-10-26 12:41 ` Cannot get thread event message: debugger service failed Christophe Benoit
2006-10-26 12:45   ` Daniel Jacobowitz
2006-10-26 13:31     ` Christophe Benoit
2006-10-26 20:01 ` Gdb Jim Blandy
2006-10-27  3:29   ` Russell Shaw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-25 19:33 gdb Richard A. Painter
2002-07-30 20:37 ` gdb Daniel Jacobowitz
2002-05-29 13:06 gdb bemis
2002-03-22  7:18 gdb Kees Everaars
2002-03-26 17:04 ` gdb Michael Snyder
     [not found] <20011117045052.5412.qmail@web13905.mail.yahoo.com>
2001-11-07  6:01 ` GDB Christopher Faylor
2001-02-27  9:14 gdb Mathieu Dube

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45417D0E.2040508@netspace.net.au \
    --to=rjshaw@netspace.net.au \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox