Re: [lldb-dev] Debugging Python scripts (backtraces, variables) with LLDB

2018-11-26 Thread Jim Ingham via lldb-dev
lldb does have an affordance for synthetic threads, but at present, those have 
to be memory threads, and once you have the 0th frame, they are backtraced just 
like ordinary threads.  So they are a start but don't provide a way to make up 
synthetic frames within a thread.  So I don't think that they do what you want 
exactly.

Recently, Kuba added the notion of a "frame recognizer" that can detect certain 
frames and alter their presentation.  The first use is adding variables to a 
frame - mostly to provide argument values to known functions for which you 
don't have debug information.
You could use that directly, recognizing the python "push a new stack frame" 
function and adding the Python locals as new variables.  The problem you will 
run into here is that we don't have a Python type system, so you'd have to 
represent these variables as C types.

In my original notion of the frame recognizers, I thought we would have more 
the directives like: "hide the next X frames", and "redirect the source info 
for this frame" and "change the language of this frame".  Then the higher layer 
frame printing code would follow the recognizer directives to produce a mixed 
stack frame.  There isn't any support for this in what Kuba did, but I think 
the framework he put in place could be extended along these lines to do the 
sort of thing you are thinking of.

Jim



> On Nov 20, 2018, at 10:08 AM, Alexandru Croitor via lldb-dev 
>  wrote:
> 
> Thanks for the link. I'm aware that VS provides that functionality (although 
> I forgot that it was open-source).
> 
> My aim would be to implement something similar in LLDB though.
> 
> 
>> On 20. Nov 2018, at 18:49, Zachary Turner  wrote:
>> 
>> 
>> 
>> On Tue, Nov 20, 2018 at 8:51 AM Alexandru Croitor via lldb-dev 
>>  wrote:
>> 
>> I would appreciate, if someone could point me to some relevant code that 
>> does something similar to what I'm asking, so I could use it as a base point 
>> for exploration.
>> 
>> Many thanks.
>> 
>> Not sure how much it will help you, but on Windows if you're using MS Visual 
>> Studio, their debugger does this.  You can seamlessly step between managed 
>> and native code and see Python callstacks interspersed with  native 
>> callstacks.  It's all open source but it's quite a lot of code to dig 
>> through, and unless you have a Windows machien, you won't be able to play 
>> around with it anyway.
>> 
>> https://github.com/Microsoft/PTVS/tree/master/Python/Product
> 
> ___
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] [Bug 39796] New: ExpressionParser: Couldn't materialize: size of variable l_32 (2628) is larger than the ValueObject's size (144)

2018-11-26 Thread via lldb-dev
https://bugs.llvm.org/show_bug.cgi?id=39796

Bug ID: 39796
   Summary: ExpressionParser: Couldn't materialize: size of
variable l_32 (2628) is larger than the ValueObject's
size (144)
   Product: lldb
   Version: 7.0
  Hardware: PC
OS: All
Status: NEW
  Severity: enhancement
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: dav...@freebsd.org
CC: llvm-b...@lists.llvm.org

$ ./clang a-prepro.c -g -O1 -Wno-everything

$ ./lldb ./a.out

(lldb) br set -l 2163
Breakpoint 1: where = a.out`func_1 + 4 at a-prepro.c:2163:21, address =
0x00010f24
(lldb) r
[…]

(lldb) frame var l_32
(const uint32_t [6][6]) l_32 = {
  [0] = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0)
  [1] = ([0] = 0, [1] = 0, [2] = 0, [3] = 1, [4] = 0, [5] = 196608)
  [2] = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0)
  [3] = ([0] = 0, [1] = 0, [2] = 0, [3] = 1, [4] = 0, [5] = 229276)
  [4] = ([0] = 969030944, [1] = 32668, [2] = 969032560, [3] = 32668, [4] =
989861584, [5] = 32668)
  [5] = ([0] = 842227457, [1] = 2065710368, [2] = 1, [3] = 0, [4] = 990120960,
[5] = 32668)
}
(lldb) p l_32
error: Couldn't materialize: size of variable l_32 (2628) is larger than the
ValueObject's size (144)
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] [Bug 39797] New: ExpressionParser: Couldn't apply expression side effects : couldn't write the new contents of l_17 back into the variable

2018-11-26 Thread via lldb-dev
https://bugs.llvm.org/show_bug.cgi?id=39797

Bug ID: 39797
   Summary: ExpressionParser: Couldn't apply expression side
effects : couldn't write the new contents of l_17 back
into the variable
   Product: lldb
   Version: 7.0
  Hardware: PC
OS: All
Status: NEW
  Severity: enhancement
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: dav...@freebsd.org
CC: llvm-b...@lists.llvm.org

$ ./clang a-prepro.c -g -O1 -Wno-everything

(lldb) br set -l 2199
Breakpoint 1: where = a.out`func_1 + 41 at a-prepro.c:2199:12, address =
0x00010f59
(lldb) r
[…]
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00010f59 a.out`func_1 at a-prepro.c:2199:12 [opt]
   2196 l_17[0] |= (*l_8);
   2197 --l_31;
   2198 }
-> 2199 return g_2[8][1];
   2200 }
   2201
   2202
(lldb) frame var l_17
(int32_t [1]) l_17 = ([0] = )
(lldb) p l_17
error: Couldn't apply expression side effects : couldn't write the new contents
of l_17 back into the variable

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] [Bug 39798] New: Expression parser: Couldn't materialize: couldn't get the value of variable g_88: DW_OP_piece for offset 4 but top of stack is of size 108

2018-11-26 Thread via lldb-dev
https://bugs.llvm.org/show_bug.cgi?id=39798

Bug ID: 39798
   Summary: Expression parser: Couldn't materialize: couldn't get
the value of variable g_88: DW_OP_piece for offset 4
but top of stack is of size 108
   Product: lldb
   Version: 7.0
  Hardware: PC
OS: All
Status: NEW
  Severity: enhancement
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: dav...@freebsd.org
CC: llvm-b...@lists.llvm.org

Created attachment 21162
  --> https://bugs.llvm.org/attachment.cgi?id=21162&action=edit
testcase

(lldb) b main
Breakpoint 1: where = a.out`main + 4 at a-prepro.c:2303:5, address =
0x00010b44
(lldb) r
Process 81971 launched:
'/Users/davide/work/llvm-project-20170507/build-rel/bin/a.out' (x86_64)
a.out was compiled with optimization - stepping may behave oddly; variables may
not be available.
Process 81971 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00010b44 a.out`main(argc=1, argv=0x7ffeefbffaf0) at
a-prepro.c:2303:5 [opt]
   2300 int print_hash_value = 0;
   2301 if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
   2302 platform_main_begin();
-> 2303 func_1();
   2304 for (i = 0; i < 8; i++)
   2305 {
   2306 csmith_sink_ = g_8[i];
(lldb) frame var g_88
(S0 [5]) g_88 = 

(lldb) p g_88
error: Couldn't materialize: couldn't get the value of variable g_88:
DW_OP_piece for offset 4 but top of stack is of size 108
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression

$ ./clang a-prepro.c -g -O1 -Wno-everything

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] 7.0.1 Release Schedule Update: Merge Request Deadline Nov 30

2018-11-26 Thread Tom Stellard via lldb-dev
Hi,

The merge request deadline was supposed to be last Wednesday, but there
are still a few outstanding issue, so I'm going to push the deadline
back to this Friday, Nov 30.  If you have any fixes you want to
get in, please file bugs and mark them as blockers for the release-7.0.1
metabug.

Thanks,
Tom
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev