Forum > macOS / Mac OS X
Difference in ParamStr(0) between running with Debugger and running without
Martin_fr:
"Process launched" is the result.
At some time prior the IDE tells lldb what file to launch. (I don't recall the lldb command, using that to rarely).
So the IDE may give it the folder, the link, or the final exe. Which one?
And if you run lldb outside the IDE, and give it any of the other, what happens. Can lldb launch that exe in a way that it gives the same result?
I recall that I tested variations to see what is needed so lldb would actually work at all. Maybe there is only one, maybe there are many options and I took the first that worked.
So, can lldb actually be called in a way that it would give the same result? Because if lldb can't, then there is nothing we can do. (nothing that I would know of).
Sorry, but I am not currently testing this myself. I don't have a Mac, I can access one remotely, but given that every mouse click and keystroke does something different from what Linux and/or Window would do, I always spent a lot of time undoing unwanted actions... Hence, I wont be checking this myself.
How did you obtain the "non debug" result?
- Click on desktop?
- open the_folder
- ./the_folder/Content/MacOs/foo
- ...
?
Do all of them return the same result?
What dose "run without debug" in the IDE return?
carl_caulkett:
--- Quote from: Martin_fr on November 07, 2024, 11:56:41 am ---How did you obtain the "non debug" result?
--- End quote ---
For the non-debug result, I'm running...
Run -> Run without Debugging in the IDE
or
Double Clicking the .app bundle from Finder.
or
open -a SchuellersRepertory.app from the command-line.
All three of these of these give Application.ExeName/ParamStr(0) as /Users/carlcaulkett/Code/fpc/SchuellersBook/SchuellersRepertory
I'm using Run -> Run in the IDE to run with the debugger.
This gives /Users/carlcaulkett/Code/fpc/SchuellersBook/SchuellersRepertory.app/Contents/MacOS/SchuellersRepertory
--- Quote from: Martin_fr on November 07, 2024, 11:56:41 am ---Sorry, but I am not currently testing this myself. I don't have a Mac, I can access one remotely, but given that every mouse click and keystroke does something different from what Linux and/or Window would do, I always spent a lot of time undoing unwanted actions... Hence, I wont be checking this myself.
--- End quote ---
No apologies necessary. It's funny how your experience of Lazarus in macOS is exactly the same as my experience of Lazarus in Linux and Windows ;)
Martin_fr:
So then, at some point the IDE send
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---target create path_fileto lldb.
And the question is, can that be changed, so that the param(0) changes?
And more, there were issues (not sure if related) that lldb failed, either m2, or intel, or cross between them. Not sure. But it is not known if changing this could create new issues... It would need wide spread testing.
carl_caulkett:
--- Quote from: Martin_fr on November 07, 2024, 04:13:42 pm ---So then, at some point the IDE send
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---target create path_fileto lldb.
And the question is, can that be changed, so that the param(0) changes?
And more, there were issues (not sure if related) that lldb failed, either m2, or intel, or cross between them. Not sure. But it is not known if changing this could create new issues... It would need wide spread testing.
--- End quote ---
Maybe I'm being oversimplistic in asking this, but wouldn't it be easier to amend the code for ParamStr(0), which is where I presume the Application.ExeName comes from, to have something like the code I posted...
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit capaths; {$mode objfpc}{$H+} interface uses Classes, SysUtils; {$IFDEF DARWIN}const APP_BUNDLE_SUFFIX = '.app/Contents/MacOS';{$ENDIF} type Paths = class private class function Sep: string; public class function AppPath: string; class function AppFolder: string; end; implementation class function Paths.Sep: string;begin Result := DirectorySeparator;end; class function Paths.AppPath: string;var Path: string; AppPos: integer;begin Path := ParamStr(0); {$IFDEF DARWIN} AppPos := Pos(APP_BUNDLE_SUFFIX, Path); if AppPos > 0 then Path := Copy(Path, 1, AppPos - 1); {$ENDIF} Result := Path;end; class function Paths.AppFolder: string;begin Result := ExtractFileDir(AppPath);end; end.
Martin_fr:
How would one modify the ParamString? Other than changing the source code of the project that is being debugged, but that doesn't make sense?
I don't know who exactly it is gotten, but the OS is providing the data for ParamString (zero and others). And it does that based on how the app was called, afaik. And how the app was called is done by lldb. The only influence (that I know of) that Lazarus has, is what it sets a "create target".
Navigation
[0] Message Index
[#] Next page
[*] Previous page