Recent

Author Topic: Difference in ParamStr(0) between running with Debugger and running without  (Read 1164 times)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #15 on: November 07, 2024, 06:16:41 pm »
@Carl_caulkett
You can approach the fpc team on that. I am doubtful of this having any chance... But I am not part of the FPC team, so ...
It also means that it would only work when using those methods. Any raw access would still disclose that the debugger caused a difference.

I realise that this is a bit of an edge-case so, as you say, the chances of getting this changed are low. In any case, the problem is easily solved, albeit in an after-the-event manner  ;)
"It builds... ship it!"

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1067
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #16 on: November 07, 2024, 08:44:26 pm »
It's documented that paramstr(0) is unreliable on Darwin/macOS: https://www.freepascal.org/docs-html/rtl/system/paramstr.html

This is based on information from an Apple engineer back in the day.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #17 on: November 07, 2024, 08:55:47 pm »
(this is the code revealed by the debugger, which makes sense because macOS is really FreeBSD in disguise ;))

macOS is not a FreeBSD in disguise. It's an operating system with a user space that takes some code from FreeBSD and NetBSD. And even if the userspace might be BSD-based there are nevertheless quite some subtle differences.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #18 on: November 07, 2024, 08:56:19 pm »
It's documented that paramstr(0) is unreliable on Darwin/macOS: https://www.freepascal.org/docs-html/rtl/system/paramstr.html

This is based on information from an Apple engineer back in the day.

Interesting! At least I can draw some comfort from the fact that this is a known issue, and I note what the web page says about not having the data stored alongside and dependent on the location of the app.
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #19 on: November 07, 2024, 09:01:23 pm »
(this is the code revealed by the debugger, which makes sense because macOS is really FreeBSD in disguise ;))

macOS is not a FreeBSD in disguise. It's an operating system with a user space that takes some code from FreeBSD and NetBSD. And even if the userspace might be BSD-based there are nevertheless quite some subtle differences.

Are you familiar with the concept of things being said in a "tongue in cheek" manner, often accompanied by a ;) emoji...?
"It builds... ship it!"

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #20 on: November 07, 2024, 10:47:35 pm »
(this is the code revealed by the debugger, which makes sense because macOS is really FreeBSD in disguise ;))

macOS is not a FreeBSD in disguise. It's an operating system with a user space that takes some code from FreeBSD and NetBSD. And even if the userspace might be BSD-based there are nevertheless quite some subtle differences.

Are you familiar with the concept of things being said in a "tongue in cheek" manner, often accompanied by a ;) emoji...?

Yes, I am, but that doesn't mean that one shouldn't leave such things uncommented. That's how rumors start after all...

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #21 on: November 07, 2024, 10:57:09 pm »
Yes, I am, but that doesn't mean that one shouldn't leave such things uncommented. That's how rumors start after all...

I've amended the original comment. I think we'll be safe now ;)
"It builds... ship it!"

PascalDragon

  • Hero Member
  • *****
  • Posts: 5750
  • Compiler Developer
Re: Difference in ParamStr(0) between running with Debugger and running without
« Reply #22 on: November 07, 2024, 11:18:12 pm »
Yes, I am, but that doesn't mean that one shouldn't leave such things uncommented. That's how rumors start after all...

I've amended the original comment. I think we'll be safe now ;)

Thanks for that 😅

 

TinyPortal © 2005-2018