Gammu has different behaviour when running under strace
Asked Answered
V

1

6

I am attempting to debug Gammu, a "library and command line utility for mobile phones", which is "timing out" when communicating normally with the modem.

gammu identify -> No response in specified timeout. Probably phone not connected.

Looking at the extra debug information it produces, for some reason, it's not "recognising" the response that the modem IS giving (given it has the correct responses when dialing the AT commands over a manual serial terminal).

However, my question is primarily about running the SAME PROGRAM under strace, where it has no problems, and does not timeout.

strace -e trace=open,close,read,write gammu identify -> (whole bunch of information about the modem)

What does/would strace be doing that would be causing this difference in behaviour? How does strace affect its child processes?

(Running on Ubuntu 18.04, Gammu 1.39.0)

Varletry answered 1/2, 2019 at 9:50 Comment(0)
C
1

I have seen this kind of behavior in different platforms. sometime code runs successfully in debugging. it means because of debugging all code works slower and because of that user does not get timeout. example

makeSomeCallToServerOrPhone();
if(noResponseIn(5))
  throw new TimeOutException();

application will throw exception in 5 milliseconds if there is no response from server. in debugging, this will work because when you run your code step by step. server will respond in time and all will work. but in normal run, that 5 milliseconds is very small and server or phone may not respond in time there you get the exception.

strace also runs program more under control like debugging and slower. and because of that gammu looks like working. probably you can give gammu configuration and change timeouts check https://wammu.eu/docs/manual/smsd/config.html

Caligula answered 17/2, 2019 at 19:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.