[Mono-dev] mono_jit_init fails when called from a Qt QThread

2010-08-11 Thread Frank Fuchs
Hi,
thank you for the hint to mono_tread_attach. I should spend more time with
RTFM. Now using this I was able to get beyond the init and the attach but
crashed again at the creation of a seperate app_domain. While this might be
accepted, since I could create the app domain in the main thread as well I
finally got stuck with the following error upon  mono_domain_assembly_open
(not using app domains at all).

Program received signal SIGSEGV, Segmentation fault.

[Switching to process 17740]

0x7fff870196d7 in pthread_mutex_lock ()

(gdb) where

#0  0x7fff870196d7 in pthread_mutex_lock ()

#1  0x000100766b86 in mono_domain_assembly_open ()

#2  0x0001000eae5d in ScriptEngineMono::ExecuteMain (this=0x1028b2250,
rFile=0x116e3f6d8 /Users/fuchs/Scripts/auto.exe) at
ScriptEngine/ScriptEngineMono.cpp:94

#3  0x0001000eb5a1 in ScriptEngineMono::CompileAndRun (this=0x1028b2250,
rSourcefiles={{p = {static shared_null = {ref = {_q_value = 3691}, alloc =
0, begin = 0, end = 0, sharable = 1, array = {0x0}}, d = 0x10287d3e0}, d =
0x10287d3e0}}) at ScriptEngine/ScriptEngineMono.cpp:168

#4  0x0001000f5d5f in ScriptEngine::run (this=0x7fff5fbfdf90) at
ScriptEngine/ScriptEngine.cpp:1153

#5  0x000101d1adaf in QThreadPrivate::start ()

#6  0x7fff8704d456 in _pthread_start ()

#7  0x7fff8704d309 in thread_start ()

Frank

Hey,

 On 10.08.2010 22:00, Frank Fuchs wrote:
 * Hi,
 ** I think I have a rather special problem here. I have a Qt C++ application 
 with an embedded mono jit.
 ** Everything works nicely so far. However, I recently tried to start the 
 Jit from a Qthread
 ** (in order to have an unblocked GUI during the C# script execution, 
 which can be several minutes).
 ** Sadly I don't even get close to execution of the assembly, since the 
 mono_jit_init_version call fails.
 ** The stack trace provided by gdb is attached below. To me it looks like Qt 
 does not play nice with pthreads as used by the GC.
 ** (I found something similar using QThreads and openmp together.)
 ** Any comments? Whose fault is it? I read something about the new GC, 
 would it cure this?
 **
 ** BTW: system is Mac OS X 10.6.4 with mono 2.7 build from trunk.
 *
 Given that mono_jit_init() can't be called more than once per
 process, you could just call it from the main thread and forget
 about the issue after you've filed a bug at
 http://mono-project.com/Bugs :)

 The real work (compiling and executing your C# scripts) can be
 performed from a separate thread, but don't forget to call
 mono_thread_attach(domain) from this thread.

 Robert


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mono_jit_init fails when called from a Qt QThread

2010-08-11 Thread Frank Fuchs
Ok I justed prepared a minimal example demonstrating the problem, just to learn 
that it runs perfectly ... now I have to find my bug :-/ .
Sorry for the buzz!

-Frank
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] VM debugger

2010-08-11 Thread Attila Suszter
Hi everyone, my problem is rather odd but you guys may have some idea.

I'm looking for a solution to perform debugging inside the VM, basically,  
what I would do is single stepping over IL instructions and watching  
locals as well as setting breakpoints (and go).

I'm aware of that this effect would be easily achieved with debug binaries  
but I have the release ones only and not really straightforward to make a  
debug build of them.

I know this would be a tool which intercepts the VM instructions but not  
sure if it exists.

Thanks for any help!

Attila
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Is there any reason to not add instead a flag?

2010-08-11 Thread Andrés G. Aragoneses
Hey Miguel, sorry for the small delay to reply:

El 10/08/10 21:41, Miguel de Icaza escribió:
 In your recent commit, you added a new command to mcs/tools/corcompare,
 the mono-abi-info tool.   I do not know what this tool does, and I do
 not know why we could not just have used mono-api-info with a new flag
 --abi instead of installing another executable.

I thought about this, but it would be a bit weird to use a tool called
mono-api-info if you don't want the API but the ABI. This is why I
thought it would be more intuitive this way.

 It goes against the If it is not documented, it does not exist rule.

Then mono-api-info doesn't exist either :) (there's no man page for it)

 So can we:
 
   (a) get this merged into mono-api-info

I'm thinking I can get it to be the same executable, but can it be a
different script called mono-abi-info which internally calls
mono-api-info.exe passing the flag?

   (b) document this on the wiki or the relevant man pages?

If there's no man page for mono-api-info, I prefer to do it in a wiki
page, ok? (Don't know man format enough to not copy-paste the structure ;) )

I'll work on it tomorrow. Thanks for the feedback.

  Andres


 
 miguel
 
 Branch: refs/heads/master
   Home: http://github.com/mono/mono

 Commit: c508a786c106ceff274b9b985919368b6b404342
 Author: Andrés G. Aragoneses kno...@gmail.com
   Date: 08/10/2010 14:36:27
URL: 
 http://github.com/mono/mono/commit/c508a786c106ceff274b9b985919368b6b404342

 Added new ABI mode to mono-api-info tool, wrapped in a mono-abi-info script.

 2010-08-05  Andrés G. Aragoneses  and...@lindenlab.com

 * mcs/tools/corcompare/mono-api-info.cs: Implemented new mode to show ABI.
 * mcs/tools/corcompare/Makefile: added mono-abi-info autofoo.
 * scripts/.gitignore: added mono-abi-info.
 * scripts/Makefile.am: added mono-abi-info autofoo.

 Changed paths:
  M ChangeLog
  M mcs/tools/corcompare/ChangeLog
  M mcs/tools/corcompare/Makefile
  M mcs/tools/corcompare/mono-api-info.cs
  M scripts/.gitignore
  M scripts/Makefile.am

 Modified: ChangeLog
 ===
 --- a/ChangeLog
 +++ b/ChangeLog
 @@ -1,3 +1,8 @@
 +2010-08-05  Andr??s G. Aragoneses  and...@lindenlab.com
 +
 +* scripts/.gitignore: added mono-abi-info.
 +* scripts/Makefile.am: added mono-abi-info autofoo.
 +
  2010-07-16  Zoltan Varga  var...@gmail.com
  
  * configure.in: Remove the 'LLVM backend is experimental' warning.
 Modified: mcs/tools/corcompare/ChangeLog
 ===
 --- a/mcs/tools/corcompare/ChangeLog
 +++ b/mcs/tools/corcompare/ChangeLog
 @@ -1,3 +1,8 @@
 +2010-08-05  Andr??s G. Aragoneses  and...@lindenlab.com
 +
 +* mono-api-info.cs: Implemented new mode to show ABI.
 +* Makefile: added mono-abi-info autofoo.
 +
  2010-04-16  C.J. Adams-Collier  c...@colliertech.org
  
  * mono-api-diff.cs: revived from the mono-2-2 branch and applied
 Modified: mcs/tools/corcompare/Makefile
 ===
 --- a/mcs/tools/corcompare/Makefile
 +++ b/mcs/tools/corcompare/Makefile
 @@ -2,7 +2,7 @@ thisdir = tools/corcompare
  SUBDIRS =
  include ../../build/rules.make
  
 -ALL_PROGRAMS = mono-api-info.exe
 +ALL_PROGRAMS = mono-api-info.exe mono-abi-info.exe
  
  CECIL = ../../class/lib/net_2_0/Mono.Cecil.dll
  
 @@ -43,3 +43,6 @@ dist-local: dist-default
  
  mono-api-info.exe: $(APIINFO_SOURCES)
  $(CSCOMPILE) -r:$(CECIL) -out:$@ $^
 +
 +mono-abi-info.exe: $(APIINFO_SOURCES)
 +$(CSCOMPILE) -r:$(CECIL) -d:ABI -out:$@ $^
 Modified: mcs/tools/corcompare/mono-api-info.cs
 ===
 --- a/mcs/tools/corcompare/mono-api-info.cs
 +++ b/mcs/tools/corcompare/mono-api-info.cs
 @@ -29,6 +29,9 @@ namespace CorCompare
  if (args.Length == 0)
  return 1;
  
 +AbiMode = false;
 +SetAbiMode ();
 +
  AssemblyCollection acoll = new AssemblyCollection ();
  
  foreach (string fullName in args) {
 @@ -45,6 +48,14 @@ namespace CorCompare
  doc.WriteTo (writer);
  return 0;
  }
 +
 +[System.Diagnostics.Conditional (ABI)]
 +private static void SetAbiMode ()
 +{
 +AbiMode = true;
 +}
 +
 +internal static bool AbiMode { get; private set; }
  }
  
  public class Utils {
 @@ -211,7 +222,7 @@ namespace CorCompare
  if (string.IsNullOrEmpty (t.Namespace))
  continue;
  
 -if ((t.Attributes  
 TypeAttributes.VisibilityMask) != TypeAttributes.Public)
 +if (!Driver.AbiMode  ((t.Attributes  
 TypeAttributes.VisibilityMask) != TypeAttributes.Public))
   

Re: [Mono-dev] Is there any reason to not add instead a flag?

2010-08-11 Thread Miguel de Icaza
Hello,

I thought about this, but it would be a bit weird to use a tool called
 mono-api-info if you don't want the API but the ABI. This is why I
 thought it would be more intuitive this way.


Minor issue.

 It goes against the If it is not documented, it does not exist rule.

 Then mono-api-info doesn't exist either :) (there's no man page for it)


What we have here is an opportunity.

You now get to write the man page and document what both do.

I'm thinking I can get it to be the same executable, but can it be a
 different script called mono-abi-info which internally calls
 mono-api-info.exe passing the flag?


I do not want that, it is a minor aesthetic issue.   Just change it to --abi
and let us be done.


 If there's no man page for mono-api-info, I prefer to do it in a wiki
 page, ok? (Don't know man format enough to not copy-paste the structure ;)
 )


I realize it is more convenient for you, but it is not more convenient for
the user that has to wonder What the hell does this do?

Granted, there is no man page, so this is why we are going to turn a
negative into a positive.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] BasicHttpBinding issues

2010-08-11 Thread Matthew Fanto
Forgive me if this is the wrong list. I checked the descriptions of the
various lists, and this one seemed to be the most relevant, as I'm seeing a
difference between running under .NET 3.5 and Mono 2.6.7.

I am attempting to create a WCF service. I've been unable to get either
NetTcpBinding or BasicHttpBinding working, yet both work fine if I run under
.NET.

Running under Mono 2.6.7 on Windows 7 x64, I occasionally get an exception
Exception during finishing channel acceptance with a
System.IndexOutofRangeException: Array index is out of range. This happens
half the time that I run the service. I never get these exceptions if I am
running under .NET.

The end of the stack trace looks like:
  at (wrapper stelemref) object:stelemref (object,intptr,object)
  at
System.Collections.Generic.List`1[System.ServiceModel.Channels.IChannel].Add
(IChannel item) [0x0001a] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.6.7\mcs\class\corlib\System.Collections.Generic\List.cs:89
  at System.ServiceModel.Dispatcher.ListenerLoopManager.ChannelAccepted
(IChannel ch) [0x0004c] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.6.7\mcs\class\System.ServiceModel\System.ServiceModel.Dispatcher\ChannelDispatcher.cs:499
  at
System.ServiceModel.Dispatcher.ListenerLoopManager+CreateAcceptorc__AnonStorey1C`1[System.ServiceModel.Channels.IReplyChannel].m__1F
(IAsyncResult result) [0x0] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.6.7\mcs\class\System.ServiceModel\System.ServiceModel.Dispatcher\ChannelDispatcher.cs:373

I can provide the full stack trace if needed.

When the service does start, any clients that attempt to connect get an
Error 400.

I create the ServiceHost with:

var host = new ServiceHost(typeof(TestService));
host.AddServiceEndpoint(typeof(ITestService), new
BasicHttpBinding(), http://127.0.0.1:/test;);
host.Open();


I have also attempted to run the service under OpenSuSE 11.3, and get the
same Error 400. Everything works fine under .NET 3.5 however.

I have set all the buffer sizes to their max value.

I'd appreciate any help or direction (or if I should be sending this to
another list).

Best,
Matt
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] 答复: [Mono-dev] Why the matrix MUST be invertible to be used in libgdiplus when we call GdipSetWorldTransform or GdipMultiplyWorldTransform?

2010-08-11 Thread oken
i think that gdiplus save the clip region in page space, the clip_matrix is 
used to translate the clip from page space to world space. because gdiplus's 
API use world space!

I have anther question:cairo use user spcae and device space, but gdiplus use 
world/page/device space. From libgdiplus's source, i find it that cairo doesn't 
handle the page scale. This results in some problems.




发件人:oken
发送日期:2010-08-08 10:36
收件人:mono-devel-l...@lists.ximian.com 
抄送:
主题:[Mono-dev] Why  the matrix MUST be invertible to be used  in libgdiplus 
when we call GdipSetWorldTransform or GdipMultiplyWorldTransform? 

hi, all!
  The following code are from libgdiplus2.6.7, in graphics.c.
  I have a few quetions:
1. Why  the matrix MUST be invertible to be used  when we call 
GdipSetWorldTransform or GdipMultiplyWorldTransform? It is unnecessary for 
windows's gdiplus.
2. each time when the world transformation is changed(translate, roate, scale), 
the function apply_world_to_bounds is called. what if we don't call 
apply_world_to_bounds?
3. GdipSetWorldTransform also change the world transformation, but it doesnt 
call world transformation, why?
4. apply_world_to_bounds use graphics-clip_matrix to transform points, why not 
use graphics-copy_of_ctm? As graphics-copy_of_ctm is the world transformation 
and graphics-clip_matrix is just the matrix of the clip region.

I use libgdiplus to draw something(I change the world transformation using the 
related functions, but the position and the size is incorrect. I don't know 
wether it has sth to do with the following questions.

thanks!

static GpStatus
apply_world_to_bounds (GpGraphics *graphics)
{
 GpStatus status;
 GpPointF pts[2];
 pts[0].X = graphics-bounds.X;
 pts[0].Y = graphics-bounds.Y;
 pts[1].X = graphics-bounds.X + graphics-bounds.Width;
 pts[1].Y = graphics-bounds.Y + graphics-bounds.Height;
 status = GdipTransformMatrixPoints (graphics-clip_matrix, (GpPointF*)pts, 
2);/* why not use graphics-copy_of_ctm?*/
 if (status != Ok)
  return status;
 if (pts[0].X  pts[1].X) {
  graphics-bounds.X = float2int(pts[1].X);
  graphics-bounds.Width = float2int(iround (pts[0].X - pts[1].X));
 } else {
  graphics-bounds.X = float2int(pts[0].X);
  graphics-bounds.Width = float2int(iround (pts[1].X - pts[0].X));
 }
 if (pts[0].Y  pts[1].Y) {
  graphics-bounds.Y = float2int(pts[1].Y);
  graphics-bounds.Height = float2int(iround (pts[0].Y - pts[1].Y));
 } else {
  graphics-bounds.Y = float2int(pts[0].Y);
  graphics-bounds.Height = float2int(iround (pts[1].Y - pts[0].Y));
 }
 return Ok;
}

GpStatus WINGDIPAPI GdipSetWorldTransform (GpGraphics *graphics, GpMatrix 
*matrix)
{
 GpStatus status;
 BOOL invertible;
 if (!graphics || !matrix)
  return InvalidParameter;
 /* optimization - inverting an identity matrix result in the identity matrix */
 if (gdip_is_matrix_empty (matrix))
  return GdipResetWorldTransform (graphics);
 /* the matrix MUST be invertible to be used */
 status = GdipIsMatrixInvertible (matrix, invertible);
 if (!invertible || (status != Ok))
  {printf(InvalidParameter\n);return InvalidParameter;}
 gdip_cairo_matrix_copy (graphics-copy_of_ctm, matrix);
 gdip_cairo_matrix_copy (graphics-clip_matrix, matrix);
 /* we already know it's invertible */
 GdipInvertMatrix (graphics-clip_matrix);

/* apply_world_to_bounds (graphics); is not called here! why?*/


 switch (graphics-backend) {
 case GraphicsBackEndCairo:
  return cairo_SetWorldTransform (graphics, matrix);
 case GraphicsBackEndMetafile:
  return metafile_SetWorldTransform (graphics, matrix);
 default:
  return GenericError;
 }
} 

GpStatus WINGDIPAPI GdipMultiplyWorldTransform (GpGraphics *graphics, GpMatrix 
*matrix, GpMatrixOrder order)
{
Status s;
 BOOL invertible;
 GpMatrix inverted;
 if (!graphics)
  return InvalidParameter;
 /* the matrix MUST be invertible to be used */
 s = GdipIsMatrixInvertible (matrix, invertible);
 if (!invertible || (s != Ok))
  {printf(InvalidParameter\n);return InvalidParameter;}
 s = GdipMultiplyMatrix (graphics-copy_of_ctm, matrix, order);
if (s != Ok)
return s;
 /* Multiply the inverted matrix with the clipping matrix */
 gdip_cairo_matrix_copy (inverted, matrix);
 s = GdipInvertMatrix (inverted);
if (s != Ok)
return s;
 s = GdipMultiplyMatrix (graphics-clip_matrix, inverted, order);
 if (s != Ok)
  return s;
 apply_world_to_bounds (graphics);
 switch (graphics-backend) {
 case GraphicsBackEndCairo:
  /* not a typo - we apply to calculated matrix to cairo context */
  return cairo_SetWorldTransform (graphics, graphics-copy_of_ctm);
 case GraphicsBackEndMetafile:
  return metafile_MultiplyWorldTransform (graphics, matrix, order);
 default:
  return GenericError;
 }
}

GpStatus WINGDIPAPI GdipRotateWorldTransform (GpGraphics *graphics, float 
angle, GpMatrixOrder order)
{
 GpStatus s;
 if (!graphics)
  return InvalidParameter;
 s = GdipRotateMatrix (graphics-copy_of_ctm, angle, order);
if (s != Ok)
return