[fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-12 Thread Joao Morais


Hello list. I've just upgraded to OSX Mavericks. GDB is no longer 
installed with xcode5 so I downloaded, compiled and installed GDB 7.6.2 
myself. I can debug my own programs, testcases and Lazarus packages if I 
use Dwarf debuginfo.


However, RTL which I compiled with "-gl" doesn't show filenames, 
procnames and line numbers anymore in the heaptrc output or stacktraces. 
If I compile RTL with "-gl -gw", GDB crashes with the following 
messages. Using FPC_2_6 and Laz_1_2 from yesterday.


While executing the command:
"TGDBMIDebuggerInstruction: "-break-insert +0", "
gdb reported:
"&"linespec.c:2445: internal-error: void decode_line_full(char **, int, 
struct symtab *, int, struct linespec_result *, const char *, const char 
*): Assertion `state->canonical_names[i].suffix != NULL' failed.\nA 
problem internal to GDB has been detected,\nfurther debugging may prove 
unreliable.""


and

The GDB command:
"-break-insert +0"
did not return any result.
The GDB process is no longer running.

Following [1] I tried to compile GDB 7.3 or below. All of them failed 
compiling or installing on Mavericks. Is this a known problem? Is there 
a workaround to see linenumbers and the like on RTL traces on Mavericks?


[1] http://www.sourceware.org/ml/gdb/2012-03/msg00055.html

Thanks!

Joao Morais


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-12 Thread Martin Frb

On 12/03/2014 11:27, Joao Morais wrote:
However, RTL which I compiled with "-gl" doesn't show filenames, 
procnames and line numbers anymore in the heaptrc output or 
stacktraces. If I compile RTL with "-gl -gw", GDB crashes with the 
following messages. Using FPC_2_6 and Laz_1_2 from yesterday.


While executing the command:
"TGDBMIDebuggerInstruction: "-break-insert +0", "
gdb reported:
"&"linespec.c:2445: internal-error: void decode_line_full(char **, 
int, struct symtab *, int, struct linespec_result *, const char *, 
const char *): Assertion `state->canonical_names[i].suffix != NULL' 
failed.\nA problem internal to GDB has been detected,\nfurther 
debugging may prove unreliable.""


Well that points to a fault in GDB. Additionally there may or may not be 
an issue with FPC and the line info it wrote.


As for the fault in GDB (crashing, rather than eoither using the line 
info or reporting an error), I can not predict at which commands it will 
be triggered.


In Lazarus Options (Tools menu), you can change the "InternalStartBreak" 
(try Entry or MainAddr).  It will lead to an alternative of the "+0" break.


But that does not fix the original issue, and gdb may crash at any other 
point.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-12 Thread Jonas Maebe


On 12 Mar 2014, at 12:27, Joao Morais wrote:

Hello list. I've just upgraded to OSX Mavericks. GDB is no longer  
installed with xcode5 so I downloaded, compiled and installed GDB  
7.6.2 myself. I can debug my own programs, testcases and Lazarus  
packages if I use Dwarf debuginfo.


However, RTL which I compiled with "-gl" doesn't show filenames,  
procnames and line numbers anymore in the heaptrc output or  
stacktraces.


That's because no one has implemented a DWARF lineinfo reader for Mac  
OS X. There is only one for Stabs. Patches are welcome.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-12 Thread Dmitry Boyarintsev
On Wed, Mar 12, 2014 at 8:01 AM, Jonas Maebe wrote:

>
> That's because no one has implemented a DWARF lineinfo reader for Mac OS
> X. There is only one for Stabs. Patches are welcome.
>
> Is there DWARF reader for other OS targets?
Is it a matter of parsing the executable (and/or being smartenough to read
from an external .dsym file, if available)

thanks,
Dmitry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-12 Thread Jonas Maebe

On 12/03/14 17:35, Dmitry Boyarintsev wrote:

On Wed, Mar 12, 2014 at 8:01 AM, Jonas Maebe mailto:jonas.ma...@elis.ugent.be>> wrote:


That's because no one has implemented a DWARF lineinfo reader for
Mac OS X. There is only one for Stabs. Patches are welcome.

Is there DWARF reader for other OS targets?


Yes.


Is it a matter of parsing the executable (and/or being smartenough to
read from an external .dsym file, if available)


You cannot read it from the executable on Mac OS X, because the DWARF 
info is left in the object files (to speed up and to reduce memory 
requirements for linking). So it's either parsing the locations of all 
object files and then parsing those (if they still exist), or locating 
and parsing the .dSYM bundle. Only supporting .dSYM bundles would be 
fine too, as far as I'm concerned.



Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-12 Thread Jim Leonard
I'm working on a project that utilizes a TSortedCollection to help keep 
items sorted during processing.  There is a need to re-sort the 
collection by different criteria on-demand as the program runs. 
(Different sort orders are an integral part of the processing.)


Unless I'm missing something, TSortedCollection lacks the ability to 
change the Compare method after initialization and/or explicitly re-sort 
the collection on-demand.  I was planning on handling each new (re)sort by:


1. Initializing a new TSortedCollection with the desired Compare method
2. Copying the contents from the old collection to the new one
3. Swap collection pointers; destroy the old collection.

This works without much penalty because the collection will never get 
beyond a reasonable size, but the implementation makes me cringe.  Is 
there a more elegant way to do this (without writing my own sort 
routines for a plain TCollection)?

--
Jim Leonard (trix...@oldskool.org)
Check out some trippy MindCandy: http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.oldskool.org/
You're all insane and trying to steal my magic bag!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-12 Thread Jim Leonard
Sorry, some Turbo Pascal-isms in my initial mail -- I see that 
FreePascal's TCollection class has an explicit .Sort method so this 
helps me re-sort on demand, but it doesn't help me switch the Compare 
method.  So, my question still stands.


On 3/12/2014 1:51 PM, Jim Leonard wrote:

I'm working on a project that utilizes a TSortedCollection to help keep
items sorted during processing.  There is a need to re-sort the
collection by different criteria on-demand as the program runs.
(Different sort orders are an integral part of the processing.)

Unless I'm missing something, TSortedCollection lacks the ability to
change the Compare method after initialization and/or explicitly re-sort
the collection on-demand.  I was planning on handling each new (re)sort by:

1. Initializing a new TSortedCollection with the desired Compare method
2. Copying the contents from the old collection to the new one
3. Swap collection pointers; destroy the old collection.

This works without much penalty because the collection will never get
beyond a reasonable size, but the implementation makes me cringe.  Is
there a more elegant way to do this (without writing my own sort
routines for a plain TCollection)?



--
Jim Leonard (trix...@oldskool.org)
Check out some trippy MindCandy: http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.oldskool.org/
You're all insane and trying to steal my magic bag!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-12 Thread Philippe
 

using the example at
http://acm.msu.ru/mkoshp/fpc/rtl/objects/tsortedcollection.html 

may
something this way ... 

Type
TMethod = ( method_type_1, method_type_2,
method_type_3); 

PMySortedCollection = ^TMySortedCollection;
TMySortedCollection = Object(TSortedCollection)
 method : TMethod;

Function Compare (Key1,Key2 : Pointer): Sw_integer; virtual; 
 procedure
setMethod( const m : TMethod);
end; 

Implementation 

Uses MyObject;


Function TMySortedCollection.Compare (Key1,Key2 : Pointer)
:sw_integer; 

begin 
 case method of

 method_type_1:
Compare:=PMyobject(Key1)^.GetField - PMyObject(Key2)^.GetField;


method_type_2: Compare:=PMyobject(Key2)^.GetField -
PMyObject(Key1)^.GetField;

 method_type_3:
Compare:=PMyobject(Key1)^.GetField - 2 * PMyObject(Key2)^.GetField; 


end;
end;

procedure TMySortedCollection.setMethod( const m :
TMethod);

begin 

 method := m; 

  

end; 

Em 12.03.2014 15:51,
Jim Leonard escreveu: 

> I'm working on a project that utilizes a
TSortedCollection to help keep 
> items sorted during processing. There
is a need to re-sort the 
> collection by different criteria on-demand
as the program runs. 
> (Different sort orders are an integral part of
the processing.)
> 
> Unless I'm missing something, TSortedCollection
lacks the ability to 
> change the Compare method after initialization
and/or explicitly re-sort 
> the collection on-demand. I was planning on
handling each new (re)sort by:
> 
> 1. Initializing a new
TSortedCollection with the desired Compare method
> 2. Copying the
contents from the old collection to the new one
> 3. Swap collection
pointers; destroy the old collection.
> 
> This works without much
penalty because the collection will never get 
> beyond a reasonable
size, but the implementation makes me cringe. Is 
> there a more elegant
way to do this (without writing my own sort 
> routines for a plain
TCollection)?

 ___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-12 Thread Jim Leonard

On 3/12/2014 2:30 PM, Philippe wrote:

Type
TMethod = ( method_type_1, method_type_2, method_type_3);


Ah, clever -- create a Compare that switches based on what I tell it to 
do.  I like that, but as far as I can tell there's no way to tell a 
TSortedCollection to "resort" -- it's kept sorted only through inserts 
and deletes.

--
Jim Leonard (trix...@oldskool.org)
Check out some trippy MindCandy: http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.oldskool.org/
You're all insane and trying to steal my magic bag!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-12 Thread Frederic Da Vitoria
2014-03-12 21:56 GMT+01:00 Jim Leonard :

> On 3/12/2014 2:30 PM, Philippe wrote:
>
>> Type
>> TMethod = ( method_type_1, method_type_2, method_type_3);
>>
>
> Ah, clever -- create a Compare that switches based on what I tell it to
> do.  I like that, but as far as I can tell there's no way to tell a
> TSortedCollection to "resort" -- it's kept sorted only through inserts and
> deletes.
>

You (or the user) will never need to resotre the first order? I am asking
because you could as well simply create one SortedCollection for each sort
order and systematically insert each item in all those collections. The
overhead would be in the initial loading, but then switching would be
instantaneous.

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TProcess on windows: incompatibility between poUsePipes and InheritHandles:=false

2014-03-12 Thread Luca Olivetti
El 11/03/14 19:43, Luca Olivetti ha escrit:

>> I have no explicit solution for you, but a few links that I hope can
>> help you further:
>>
>> http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx
> 
> What surprises me is that it says that handles by default are
> non-inheritable

It turns out that sockets by default *are* inheritable, but that doesn't
really work reliably, and at the same time you *cannot* stop them from
being inheritable

http://stackoverflow.com/questions/12058911/can-tcp-socket-handles-be-set-not-inheritable

Now I know that windows has been designed by Vicky Pollard.

Bye
-- 
Luca

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Elegant way to switch sort mechanism in TSortedCollection?

2014-03-12 Thread Philippe
 

solution may depend on the way the collection is used. load once?
many inserts and deletes? ... the time you have to switch from one sort
to another ... and the size of the collection ... 

you could 

- store
the actual collection to a TMemoryStream, 

- destroy the collection,


- Load then a new collect to be sort with different method ...


2014-03-12 21:56 GMT+01:00 Jim Leonard :Em
12.03.2014 19:06, Frederic Da Vitoria escreveu: 

>> On 3/12/2014 2:30
PM, Philippe wrote:
>> 
>>> Type
>>> TMethod = ( method_type_1,
method_type_2, method_type_3);
>> 
>> Ah, clever -- create a Compare
that switches based on what I tell it to do. I like that, but as far as
I can tell there's no way to tell a TSortedCollection to "resort" --
it's kept sorted only through inserts and deletes.
> You (or the user)
will never need to resotre the first order? I am asking because you
could as well simply create one SortedCollection for each sort order and
systematically insert each item in all those collections. The overhead
would be in the initial loading, but then switching would be
instantaneous. 
> 
> -- 
> Frederic Da Vitoria
> (davitof)
> 
> Membre
de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org [2] 
> 
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org
>
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [1]




Links:
--
[1]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[2]
http://www.april.org
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal