Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1039)

Issue 6995161: Extend gdb-jit support (OSX/locals+parameters/prettyprint) (Closed)

Created:
9 years, 6 months ago by zarko
Modified:
9 years, 5 months ago
CC:
v8-dev
Base URL:
git://github.com/v8/v8.git@master
Visibility:
Public.

Description

Extend gdb-jit support (OSX/locals+parameters/prettyprint) Generate Mach-O in-memory objects for OSX. Dump locals and parameters for non-optimized frames. Unfortunately, it seems like more-recent-GDB on OSX there is a little temperamental (eg, the version from macports will be missing symbols from gdb-integration_g when the version included in xcode will not-- and this is with --gdbjit off). Includes some Python scripts to make dealing with V8 values in gdb more pleasant. Patch by Luke Zarko. Committed: http://code.google.com/p/v8/source/detail?r=8483

Patch Set 1 #

Total comments: 34

Patch Set 2 : Address comments. #

Patch Set 3 : Remove files from samples/; drop sample from SConstruct. #

Patch Set 4 : Rebase. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+826 lines, -60 lines) Patch
M SConstruct View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/compiler.cc View 1 3 chunks +5 lines, -3 lines 0 comments Download
M src/flag-definitions.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M src/gdb-jit.h View 1 2 chunks +6 lines, -2 lines 0 comments Download
M src/gdb-jit.cc View 1 2 3 29 chunks +657 lines, -53 lines 1 comment Download
A tools/gdb-v8-support.py View 1 chunk +154 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
zarko
If you get a chance, please take a look at this changelist. Although it's not ...
9 years, 6 months ago (2011-06-13 20:48:17 UTC) #1
Vyacheslav Egorov (Chromium)
First round of comments. Overall MACH support and extended DWARF support looks very good, thanks ...
9 years, 6 months ago (2011-06-23 11:14:47 UTC) #2
Vyacheslav Egorov (Chromium)
A bit more comments. http://codereview.chromium.org/6995161/diff/1/src/gdb-jit.cc File src/gdb-jit.cc (right): http://codereview.chromium.org/6995161/diff/1/src/gdb-jit.cc#newcode1293 src/gdb-jit.cc:1293: int current_abbreviation = 4; Move ...
9 years, 6 months ago (2011-06-23 11:28:37 UTC) #3
zarko
gdb on OSX is really touchy! http://codereview.chromium.org/6995161/diff/1/src/gdb-jit.cc File src/gdb-jit.cc (right): http://codereview.chromium.org/6995161/diff/1/src/gdb-jit.cc#newcode47 src/gdb-jit.cc:47: #endif Done (though ...
9 years, 6 months ago (2011-06-27 22:24:29 UTC) #4
Vyacheslav Egorov (Chromium)
I think it's ready to land but I really want to exclude contents of samples ...
9 years, 5 months ago (2011-06-28 10:33:31 UTC) #5
zarko
On 2011/06/28 10:33:31, Vyacheslav Egorov wrote: > I think it's ready to land but I ...
9 years, 5 months ago (2011-06-28 20:29:54 UTC) #6
Vyacheslav Egorov (Chromium)
Great. I'll be landing it then.
9 years, 5 months ago (2011-06-29 11:10:40 UTC) #7
Vyacheslav Egorov (Chromium)
I was doing some prelanding tests and found a couple of problems: 1) __function does ...
9 years, 5 months ago (2011-06-29 12:12:02 UTC) #8
zarko
9 years, 5 months ago (2011-06-29 18:25:07 UTC) #9
On 2011/06/29 12:12:02, Vyacheslav Egorov wrote:
> I was doing some prelanding tests and found a couple of problems:
> 
> 
> 1) __function does not work for x64 at least on my simple test:
> 
> function g () { return 1; }
> function f () {
>   var ret = 0;
>   for (var i = 1; i < 10000000; i++) {
>     ret += g ();
>   }
>   return ret;
> }
> f()
> 
> set breakpoint in g with b g
> v8print __function
> 
> Printed some SMI for me.

That's pretty interesting; in ia32 this works fine, and if you drop out of the
function everything's OK too. The context appears to be correct in both
instances. Right now I am calculating the address of the function slot as:

        w->Write<uint8_t>(DW_OP_fbreg);
        w->WriteSLEB128(JavaScriptFrameConstants::kFunctionOffset);

(which on x64 turns into rbp-0x10)

and the context slot as:

        w->Write<uint8_t>(DW_OP_fbreg);
        w->WriteSLEB128(StandardFrameConstants::kContextOffset);

(which on x64 turns into rbp-0x8)

Is there some condition that would lead to the x64 code generator placing the
function somewhere else?

> 2) It's a bit unhandy that we declare locals to be some pointer sized
structure.
> User can't use normal print to print their values. See comment below. Is it
> intentional?

Yes, because otherwise gdb will ignore the pretty printer. I had a version
previously using DW_ATE_address and DW_TAG_base_type, but felt that it was
clearer if the user would see SMIs properly shifted and heap pointers
identified.

> 
> 3) I am a bit concerned that abbrev generation and DebugInfoSection are not
> glued together. This is completely unrelated to this CL but I think if we
start
> putting more and more stuff there we'll suffer huge headache if we don't hide
> them both under the same abstraction that writes both abbrevs and debug info
> sections.

Agreed; I'll look into ways to address this in a future CL.

> 
> http://codereview.chromium.org/6995161/diff/6003/src/gdb-jit.cc
> File src/gdb-jit.cc (right):
> 
> http://codereview.chromium.org/6995161/diff/6003/src/gdb-jit.cc#newcode1337
> src/gdb-jit.cc:1337: w->WriteULEB128(DW_TAG_STRUCTURE_TYPE);
> What about using DW_TAG_base_type with DW_ATE_address instead of
> DW_TAG_STRUCTURE_TYPE?
> 
> I think this would allow GDB to produce something meaningfull when you say
> "print __function" instead of just ().
> 
> It would be even better if we could hook type of locals to be
> v8::internal::Object* but I can't grok how to do it just from DWARF2 spec.
I'll
> ask Paul whether this is possible.

Is there a way to do this without depending on the way gcc mangles names (or is
that not an issue here)?

Powered by Google App Engine
This is Rietveld 408576698