Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-05

Darwin i386

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrew Brunner

I'm having a hard time with GDB and debugging threads on a OSX 10.7.4 with fpc/trunk

The shipped gdb worked great with the exception of threads calling methods via synchronize (so I can debug).

I'm in the process of building GDB from download and configure set gdb to x64 darwin. Configure detected correctly but my gdb 7.4.1 app fails to load with some ioctl error. I'm assuming fpc can't compile darwin x64 yet.

I tried # gdb ./configure --target=i386-apple-darwin but I think it needs i386 gcc compiler.

I downloaded gcc from subversion and tried to configure and it too configures make files to x64 darwin :-(

Has anyone got the latest GDB running on darwin? Any instructions or tips for getting gdb 7.4 working properly?

Reply by email

Jonas Maebe
to Andrew Brunner
Andrew Brunner wrote 5 lines
I'm having a hard time with GDB and debugging threads on a OSX 10.7.4 with fpc/trunk The shipped gdb worked great with the exception of threads calling methods via synchronize (so I can debug).

What are you doing exactly, what happens, and what is the expected result instead?

I'm in the process of building GDB from download and configure set gdb to x64 darwin. Configure detected correctly but my gdb 7.4.1 app fails to load with some ioctl error. I'm assuming fpc can't compile darwin x64 yet.

a) FPC can in fact compile for x86-64/Darwin, although that's unrelated to any of the above b) the error you are getting are probably due to the fact that your gdb binary hasn't been blessed to allow it to use the necessary OS calls

Google "gdb" together the exact error message you are getting, and you will probably find instructions about what you have to do. Or more easily: just use fink or macports to compile/install a different gdb (macports is more likely to have the most recent one available), then everything will be taken care of for you. It's unlikely that it will help with the problem you are having though, because I've never heard of any problems particularly related to debugging multithreaded applications with the stock gdb on Mac OS X.

Jonas

Reply by email

Andrew Brunner
to Jonas Maebe
Show quoted text 5 lines
What are you doing exactly, what happens, and what is the expected result instead?

I'm upgrading my gdb from shipping version with darwin to gdb version from download. I downloaded and ran /configure make make install 7.1. It doesn't work with fpc. I'm going to have to switch back. The newer versions require code signing...

warning: dsym file UUID doesn't match the one in
/Developer/Source/Builds/Aurawin/AuCloud/Apple/32/AuCloud (no debugging symbols found)...done.
(gdb) run
Starting program: /Developer/Source/Builds/Aurawin/AuCloud/Apple/32/AuCloud Unable to find Mach task port for process-id 62916: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) (gdb)

(gdb) run
Starting program: /Developer/Source/Builds/Aurawin/AuCloud/Apple/32/AuCloud Unable to find Mach task port for process-id 62916: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) (gdb)

BUT: sudo gdb bypasses this problem, and the program can get past this error but when the program launches, gdb gives

(gdb) run
Starting program: /Developer/Source/Builds/Aurawin/AuCloud/Apple/32/AuCloud [New Thread 0x2003 of process 62922]
[New Thread 0x2103 of process 62922]
[New Thread 0x2203 of process 62922]
[New Thread 0x2303 of process 62922]
[New Thread 0x2403 of process 62922]
[New Thread 0x2503 of process 62922]
[New Thread 0x2603 of process 62922]
[New Thread 0x2703 of process 62922]
TCarbonTabsControl.SetFocus Error: SetKeyboardFocus failed with result -30585
warning: dsym file UUID doesn't match the one in
/Developer/Source/Builds/Aurawin/AuCloud/Apple/32/AuCloud (no debugging symbols found)...done.

BUT notice TCarbonTabsControl.SetFocus Error: SetKeyboardFocus failed with result -30585. Now the main screen has no focus. I can only close the window :-)

Progress but I need to get gdb 7.1 to run properly on darwin. Either that or I gotta restore the old gdb :-(

Google "gdb" together the exact error message you are getting, and you will

Show quoted text 9 lines
probably find instructions about what you have to do. Or more easily: just use fink or macports to compile/install a different gdb (macports is more likely to have the most recent one available), then everything will be taken care of for you. It's unlikely that it will help with the problem you are having though, because I've never heard of any problems particularly related to debugging multithreaded applications with the stock gdb on Mac OS X.

I've been. I didn't have a problem with GCC or GDB. I've got the latest and greatest of both. This is a darwin thing. gdb can't operate properly without root access.

I've built a system cert. I've used codesign -s gdb-cert ./gdb and darwin asked for my admin creds. So I know gdb has been signed. I used which gdb to make sure I was in the right place to codesign.

Can you tell me how to compile fpc to make 64bit lazarus?

Reply by email

Jonas Maebe
to Andrew Brunner
Andrew Brunner wrote
> What are you doing exactly, what happens, and what is the expected result > instead? I'm upgrading my gdb from shipping version with darwin to gdb version from

The above was a question relating to "... with the exception of threads calling methods via synchronize (so I can debug)." I.e., what are the exact things you are doing, what is happening, and what are the expected results regarding trying to debug threads calling methods via synchronize (which, I assume, works on other platforms but not on Mac OS X).

download. I downloaded and ran /configure make make install 7.1.

Mainline GDB 7.1 is not supported on Mac OS X 10.7. The first GDB version with 10.7 support is GDB 7.4 (see the release notes at http://sourceware.org/gdb/wiki/GDB_7.4_Release, search for "lion")

Show quoted text 6 lines
It doesn't work with fpc. I'm going to have to switch back. The newer versions require code signing... warning: dsym file UUID doesn't match the one in /Developer/Source/Builds/Aurawin/AuCloud/Apple/32/AuCloud

The above message means that you have not regenerated the .dSYM bundle with debug information for your application via passing -Xg to the compiler command line options. Either delete the .dSYM bundle, or recompile with -Xg or run dsymutil on the generated binary (make sure to select DWARF debug information when using -Xg/dsymutil on Mac OS X, with Stabs it will probably disable debugging instead).

BUT notice TCarbonTabsControl.SetFocus Error: SetKeyboardFocus failed with result -30585. Now the main screen has no focus. I can only close the window :-)

That is unrelated to FPC or even Lazarus. Maybe mainline GDB does not take into account the property list of the app bundle to launch the application as a foreground application. You can try to work around that by using TransformProcessType with the kProcessTransformToForegroundApplication parameter in your program's initialization code (see e.g. http://cocoadev.com/wiki/TransformProcessType )

Can you tell me how to compile fpc to make 64bit lazarus?

You don't have to recompile FPC, the default FPC installation already includes a 64 bit cross-compiler ("ppcx64", or "fpc -P x86_64"). To compile a 64 bit Lazarus on Mac OS X, you will have to select the Qt widgetset since Carbon is not supported in 64 bit mode (and the Cocoa widegetset is not yet sufficiently far along). Regarding how to compile Lazarus so it uses the Qt widget set: I have no idea how to do that, please ask on the Lazarus mailing list (or search the wiki with Google, it's probably documented there somewhere as well).

Jonas

Reply by email

Andrew Brunner
to Jonas Maebe

On Sun, May 20, 2012 at 8:52 AM, Jonas Maebe The
above was a question relating to "... with the exception of threads calling methods via synchronize (so I can debug)." I.e., what are the exact things you are doing, what is happening, and what are the expected results regarding trying to debug threads calling methods via synchronize (which, I assume, works on other platforms but not on Mac OS X).

Sorry. Kinda missed that. Debugging heavily threaded code under linux has proved to be difficult. So I have developed a directive that triggers threaded code to execute via synchronize.

I recently cleared all linux issues with a core networking engine (both client and server) and moved to Apple to test. On Apple I needed to step into code that normally runs reentrant from the main thread, from other threads, and from other threads via synchronize.

On Linux all was fine. On Apple - I was seeing thread locking to my network engine in client mode. Same code, different operation system. I traced all the way to the signaling mechanisms in the classes unit. The thread went into wait infinite and never executed the method.

So instead of complaining about it here - I decided to method scheduling system for the engine. This way when the engine is idle it can execute methods in its own thread space. During debug mode I run engine callbacks via synchronize. On linux I get no problems. On Apple I had gotten tons of timeout errors and weird behavior that takes 5-10 seconds to step over or into each line!

So I have gdb 7.4.1 from source installed and I can't test. I may have to revert back to gdb stock just to get back to work :)

Reply by email