[Mono-dev] How to stop and debug native code of a method?

2016-07-12 Thread Pin Cheng
Hi All,
I am porting mono to a platform,
I wander if I want to trace a method(compiled into native code) how do
You stop the program running when entering into this method? Gdb can
Watch the PC register, but it is very slow, I have wait for tens of minutes.
Is there any efficient way to interrupt some method running?
Thank you in advance.

Pin



Rocket Software, Inc. and subsidiaries ? 77 Fourth Avenue, Waltham MA 02451 ? 
+1 877.328.2932 ? +1 781.577.4321
Unsubscribe From Commercial Email - unsubscr...@rocketsoftware.com
Manage Your Subscription Preferences - 
http://info.rocketsoftware.com/GlobalSubscriptionManagementEmailFooter_SubscriptionCenter.html
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy


This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Could sgen works with pthread?

2016-04-05 Thread Pin Cheng
Hi All,
I am porting mono into old aix host, my platform doesn't support __thread
Key word. I notice https://bugzilla.novell.com/show_bug.cgi?id=660413
Described that mono doesn't support sgen with pthread.
I am using Mono 4.2.1, does this release overcome the limitation?
I have research the source code it seems not. But I am not very sure.

Thank you in advance.
Pin



Rocket Software, Inc. and subsidiaries ? 77 Fourth Avenue, Waltham MA 02451 ? 
+1 877.328.2932 ? +1 781.577.4321
Unsubscribe From Commercial Email - unsubscr...@rocketsoftware.com
Manage Your Subscription Preferences - 
http://info.rocketsoftware.com/GlobalSubscriptionManagementEmailFooter_SubscriptionCenter.html
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy


This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] How to debug native code?

2016-01-18 Thread Pin Cheng
Hi all,
I am trying to port Mono into Aix host, I have am very fundamental question:
How are you guys debug native code?
Because JIT compiler compiles assembly into native code then JIT invoke it,
I am very curious if there errors in native code How do you find out the bug 
and fix it.
And if you updates the cpu-.md or -codegen.h how do you verify your 
changes is ok?
There must be somewhat effect method to debug the JIT and it specific 
architecture.

Since I am porting Mono into Aix, I got  assembler code which disassembled from 
native code:
   0: 7c 08 02 a6   mflrr0
   4: 90 01 00 04  stw r0,4(r1)
   8: 94 21 ff b0   stwur1,-80(r1)
   c:  93 61 00 48  stw r27,72(r1)
  10:93 e1 00 4c  stw r31,76(r1)
  14:7c 3f 0b 78   mr  r31,r1
  18:90 7f 00 28   stw r3,40(r31)
  1c:90 9f 00 2c   stw r4,44(r31)
  20:90 bf 00 30   stw r5,48(r31)
  24:90 df 00 34   stw r6,52(r31)
  28:38 60 00 00  li  r3,0
  2c:90 7f 00 20   stw r3,32(r31)
  30:38 60 00 00  li  r3,0
  34:90 7f 00 24   stw r3,36(r31)
  38:80 7f 00 30   lwz r3,48(r31)
  3c:2c 03 00 00   cmpwi   r3,0
  40:41 82 00 a4  beq 0xe4
  44:3c 60 20 03   lis r3,8195
  48:60 63 e5 04  ori r3,r3,58628
  4c:80 63 00 00  lwz r3,0(r3)
  50:2c 03 00 00   cmpwi   r3,0
  54:41 82 00 38  beq 0x8c
  58:3d 80 30 3c  lis r12,12348
  5c:61 8c cd d8  ori r12,r12,52696
  60:7d 88 03 a6  mtlrr12
  64:4e 80 00 21  blrl
  68:7c 64 1b 78  mr  r4,r3
  6c:7c 9b 23 78  mr  r27,r4
  70:2c 03 00 00   cmpwi   r3,0
  74:41 82 00 18  beq 0x8c
  78:7f 63 db 78  mr  r3,r27
  7c:3d 80 30 00  lis r12,12288
  80:61 8c 82 90   ori r12,r12,33424
  84:7d 88 03 a6  mtlrr12
  88:4e 80 00 21  blrl
  8c:80 7f 00 2c   lwz r3,44(r31)
  90:80 83 00 00  lwz r4,0(r3)
  94:80 7f 00 28   lwz r3,40(r31)
  98:80 bf 00 34   lwz r5,52(r31)
  9c:7c a8 03 a6   mtlrr5
  a0:4e 80 00 21  blrl
  a4:48 00 00 38  b   0xdc
  a8:80 7f 00 1c   lwz r3,28(r31)
  ac:80 7f 00 1c   lwz r3,28(r31)
  b0:90 7f 00 24   stw r3,36(r31)
  b4:80 7f 00 30   lwz r3,48(r31)
  b8:80 9f 00 24   lwz r4,36(r31)
  bc:90 9f 00 40   stw r4,64(r31)
  c0:90 83 00 00  stw r4,0(r3)
  c4:3d 80 30 3c  lis r12,12348
  c8:61 8c cf 50ori r12,r12,53072
  cc: 7d 88 03 a6  mtlrr12
  d0:4e 80 00 21  blrl
  d4:80 7f 00 40   lwz r3,64(r31)
  d8:48 00 00 04  b   0xdc
  dc:80 7f 00 20   lwz r3,32(r31)
  e0:48 00 00 38  b   0x118
  e4:3c 60 20 03   lis r3,8195
  e8:60 63 e5 04  ori r3,r3,58628
  ec:80 63 00 00  lwz r3,0(r3)
  f0: 28 03 00 00  cmplwi  r3,0
  f4: 40 82 00 40  bne 0x134
  f8: 48 00 00 04  b   0xfc
  fc: 80 7f 00 2c   lwz r3,44(r31)
100:   80 83 00 00  lwz r4,0(r3)
104:   80 7f 00 28   lwz r3,40(r31)
108:   80 bf 00 34   lwz r5,52(r31)
10c:   7c a8 03 a6   mtlrr5
110:   4e 80 00 21  blrl
114:   80 7f 00 20   lwz r3,32(r31)
118:   80 1f 00 54   lwz r0,84(r31)
11c:   7c 08 03 a6   mtlrr0
120:   7f ec fb 78   mr  r12,r31
124:   83 7f 00 48   lwz r27,72(r31)
128:   83 ff 00 4clwz r31,76(r31)
12c:   38 2c 00 50   addir1,r12,80
130:   4e 80 00 20  blr
134:   3d 80 30 3c  lis r12,12348
138:   61 8c cd d8  ori r12,r12,52696
13c:   7d 88 03 a6  mtlrr12
140:   4e 80 00 21  blrl
144:   7c 64 1b 78  mr  r4,r3
148:   7c 9b 23 78  mr  r27,r4
14c:   2c 03 00 00   cmpwi   r3,0
150:   41 82 ff acbeq 0xfc
154:   7f 63 db 78  mr  r3,r27
158:   3d 80 30 00  lis r12,12288
15c:   61 8c 82 90   ori r12,r12,33424
160:   7d 88 03 a6  mtlrr12
164:   4e 80 00 21 

[Mono-dev] A segement fault on PPC host

2015-12-28 Thread Pin Cheng
Hi there,
I am trying to porting Mono 4.2.1 into aix 6.1, it was compiled in 32bits mode.
At present, I faced a segment fault at :
return runtime_invoke (obj, params, exc, info->compiled_method);
this is line is the last one in function mono_jit_runtime_invoke.
It seems  'runtime_invoke' could not be invoked so it leads to core dump.  The 
call stack is following:
#0  0x7c0802a4 in ?? ()
#1  0x102ff224 in mono_jit_runtime_invoke (method=0x200def38, obj=0x30400038, 
params=0x2ff22800, exc=0x0) at mini-runtime.c:2343
#2  0x100db4d8 in mono_runtime_invoke (method=0x200def38, obj=0x30400038, 
params=0x2ff22800, exc=0x0) at object.c:2783
#3  0x10184580 in create_exception_two_strings (klass=0x200dca60, 
a1=0x30400010, a2=0x0) at exception.c:142
#4  0x10184624 in mono_exception_from_name_two_strings (image=0x2009cad8, 
name_space=0x1046e2cc <__popcount_tab+15548> "System",
name=0x1046e2d4 <__popcount_tab+15556> "OutOfMemoryException", 
a1=0x30400010, a2=0x0) at exception.c:165
#5  0x1017d358 in create_domain_objects (domain=0x20099078) at appdomain.c:186
#6  0x1017d630 in mono_runtime_init (domain=0x20099078, start_cb=@0x200230e0: 
0x102fb84c ,
attach_cb=@0x200230ec: 0x102fb988 ) at 
appdomain.c:265
#7  0x103012c0 in mini_init (filename=0x2ff22ce6 "./hello.exe", 
runtime_version=0x0) at mini-runtime.c:3140
#8  0x10013db4 in mono_main (argc=2, argv=0x2ff22c48) at driver.c:1906
#9  0x1a20 in mono_main_with_options (argc=2, argv=0x2ff22c48) at main.c:91
#10 0x1aa8 in main (argc=2, argv=0x2ff22c48) at main.c:122

Hello.exe is a simple C# program compiled on linux platform.
public class HelloWorld
{
static public void Main ()
{
}
}

I think the runtime_invoke is just a invoke wrapper, the actual function is 
info->compiled_method.
I could print out those function debug info:
invoker:  (wrapper runtime-invoke) :runtime_invoke_void__this___object 
(object,intptr,intptr,intptr) + 0x0 (303cdde8 303cdf50) [20099078 - hello.exe]
compiled method:  System.OutOfMemoryException:.ctor (string) + 0x0 (303cdd80 
303cddcc) [20099078 - hello.exe]

My question are:
1. why use a invoker wrapper? Where did runtime_invoke_void__this___object 
comes from?
2.  I guess JIT could not compile such runtime_invoke_void__this___object 
(object,intptr,intptr,intptr) correctly. But how could I find out the problem 
place?
Should I inspect the native definition places. Such as cpu-ppc.md and 
mini-ppc.c and so on. Is my direction correct? Is there any another simpler way 
to resolve the problem?

I am new to Mono, many thing I need to learn. Please help me.
Thank you in advance!

Pin





Rocket Software, Inc. and subsidiaries ? 77 Fourth Avenue, Waltham MA 02451 ? 
+1 800.966.3270 ? +1 781.577.4321
Unsubscribe From Commercial Email - unsubscr...@rocketsoftware.com
Manage Your Subscription Preferences - 
http://info.rocketsoftware.com/GlobalSubscriptionManagementEmailFooter_SubscriptionCenter.html
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy


This communication and any attachments may contain confidential information of 
Rocket Software, Inc. All unauthorized use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please notify Rocket 
Software immediately and destroy all copies of this communication. Thank you.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list