Last Comment Bug 184013 - put a useful gdbinit in the tree so it's found automagically
: put a useful gdbinit in the tree so it's found automagically
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: All Linux
: -- normal (vote)
: mozilla15
Assigned To: :Ehsan Akhgari
:
: Gregory Szorc [:gps]
Mentors:
Depends on:
Blocks: contrib-engagement
  Show dependency treegraph
 
Reported: 2002-12-06 17:48 PST by Dan Mosedale (:dmose)
Modified: 2012-05-03 17:06 PDT (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
gdbinit patch, v1 (2.01 KB, patch)
2002-12-06 17:51 PST, Dan Mosedale (:dmose)
no flags Details | Diff | Splinter Review
Patch (v1) (2.55 KB, patch)
2010-04-05 12:12 PDT, :Ehsan Akhgari
no flags Details | Diff | Splinter Review
Patch (v2) (4.72 KB, patch)
2010-05-01 15:45 PDT, :Ehsan Akhgari
no flags Details | Diff | Splinter Review
Patch (v3) (5.94 KB, patch)
2012-05-02 16:24 PDT, :Ehsan Akhgari
jimb: review+
Details | Diff | Splinter Review

Description Dan Mosedale (:dmose) 2002-12-06 17:48:08 PST
So that even people who don't read the FAQ get a gdb that's minimially usable.
Comment 1 Dan Mosedale (:dmose) 2002-12-06 17:51:03 PST
Created attachment 108560 [details] [diff] [review]
gdbinit patch, v1

This is taken from the FAQ, but has modifications to the way set auto-solib-add
is used so that attach works better.
Comment 2 Christopher Blizzard (:blizzard) 2002-12-06 18:39:52 PST
Did you know that with really recent snapshots of gdb that you don't need the
auto-solib-add hacks wrt performance?  It still uses lots of memory, though.
Comment 3 Andrew Schultz 2002-12-06 21:04:07 PST
disabling loading the libraries also makes one more step in telling newbies how
to get a stack, which is basically going to be 

% mozilla -g -d gdb
(gdb) set auto-solib-add 1
(gdb) run
[crash]
(gdb) bt

loading libs individually is too complicated for newbies.

the real advantage is to users who do a lot of debugging, but (for me at least)
it's a lot faster to get mozilla to the point where it will crash (or I want to
debug) and then attach gdb.  it still uses lots of memory (230MB) and isn't
useful for catching stuff during startup, but it's more than 2x faster.
Comment 4 Dan Mosedale (:dmose) 2007-03-26 16:29:28 PDT
Assigning bugs that I'm not actively working on back to nobody; use
SearchForThis as a search term if you want to delete all related bugmail at
once.
Comment 5 :Ehsan Akhgari 2010-03-26 17:05:42 PDT
Is there interest in this bug any more?  I'm willing to create a new patch if there is.
Comment 6 Ted Mielczarek [:ted.mielczarek] 2010-03-26 17:10:50 PDT
I don't know, what would you put in there? I would be willing to bet there are some nice Archer-gdb scripts around these days...
Comment 7 :Ehsan Akhgari 2010-03-26 17:22:29 PDT
http://www.mozilla.org/unix/.gdbinit
and any other useful things that folks have.

I don't know much about Archer-gdb.
Comment 8 Dan Mosedale (:dmose) 2010-04-05 09:46:08 PDT
I think it would help drive down the barrier to entry for developmen, so I'd say it would be great to get a patch here and land it...
Comment 9 :Ehsan Akhgari 2010-04-05 12:12:02 PDT
Created attachment 437095 [details] [diff] [review]
Patch (v1)

Here's an updated patch.
Comment 10 :Ehsan Akhgari 2010-05-01 15:45:14 PDT
Created attachment 442948 [details] [diff] [review]
Patch (v2)

Add cjone's ptarray:

http://blog.mozilla.com/cjones/2010/04/30/print-nstarrays-in-gdb/
Comment 11 Ted Mielczarek [:ted.mielczarek] 2010-05-18 12:20:15 PDT
Comment on attachment 442948 [details] [diff] [review]
Patch (v2)

I defer to jimb.
Comment 12 Jim Blandy :jimb 2012-05-02 15:27:46 PDT
Ehsan, if you could check that the .gdbinit here is up to date, I'll r+ it.
Comment 13 :Ehsan Akhgari 2012-05-02 16:24:59 PDT
Created attachment 620513 [details] [diff] [review]
Patch (v3)

I've added a few other macros since I attached the patch here!
Comment 14 Josh Matthews [:jdm] (on vacation until Dec 5) 2012-05-02 16:56:54 PDT
I also recommend this:

>def jsinfo
> call JS_PCToLineNumber(cx, script, regs.pc)
> printf "%s:%d\n", script.ptr->filename, $
>end
Comment 15 :Ehsan Akhgari 2012-05-02 19:19:56 PDT
(In reply to Josh Matthews [:jdm] (travelling until June 25th, not reading non-CCed bugmail) from comment #14)
> I also recommend this:
> 
> >def jsinfo
> > call JS_PCToLineNumber(cx, script, regs.pc)
> > printf "%s:%d\n", script.ptr->filename, $
> >end

Let's land this first, I don't wanna stall this more than necessary.  Once this is in the tree, everyone can add all sorts of macros.  :-)

Note You need to log in before you can comment on or make changes to this bug.