I'll not pursue strace further at this time.
As to programming language, I have the choice of either BASIC or Tcl.
I've not used BASIC in years.
I'm learning Tcl using tcltutor30b7. I've verified my program logic with yabasic. Tcltutor gives handy diagnostics. I'm translating my code to Tcl. It is a learning experience ;/

On 08/20/2018 10:11 AM, to...@tuxteam.de wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Aug 20, 2018 at 06:55:19AM -0500, Richard Owlett wrote:

[...]

However if you do:
       > strace -o mytrace yabasic test.bas
it executes, but doesn't apparently doesn't give any explanation ow
why the two files cannot be opened.

Hm. You will have realized that strace's output is extremely chatty:
you'll see the open for all possible libraries your program tries
to get hold of, then typically, after that succeeded, mmaping those
libraries into the process's address space, many failed attempts
at opening config and auxiliary files (in search of them at different
possible locations) until the program is where you consider it "up
and running".

You'll have to wade through it. Ah -- and if the program is just a
wrapper calling other processes, you'll have to tell strace to follow
them (option -f). For example (I use the option '-f', although I know
that 'cat' doesn't fork):

   strace -o /tmp/trace -f cat /no/such/file

I get the (expected) error:

   cat: /no/such/file: No such file or directory

and my /tmp/trace contains:

   4157  execve("/bin/cat", ["cat", "/no/such/file"], [/* 26 vars */]) = 0
   4157  brk(NULL)                         = 0x55850a279000
   4157  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or 
directory)
   4157  mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0x7f7c303fc000

   # here you see the loading of the binary (execve), allocating memory (brk),
   # start of the search for the "interpreter" for the binary, etc.

   # lots of lines elided (roughly 85, in your program they'll be
   # quite a few more

   4157  fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
   4157  open("/no/such/file", O_RDONLY)   = -1 ENOENT (No such file or 
directory)

   # this is the failed attempt at opening "/no/such/file"

   4157  write(2, "cat: ", 5)              = 5
   4157  write(2, "/no/such/file", 13)     = 13
   4157  open("/usr/share/locale/C.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 
ENOENT (No such file or directory)
   4157  open("/usr/share/locale/C.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 
ENOENT (No such file or directory)
   4157  open("/usr/share/locale/C/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
   4157  write(2, ": No such file or directory", 27) = 27
   4157  write(2, "\n", 1)                 = 1

   # and this is the output of the error message to stderr (file descriptor 2)

   4157  close(1)                          = 0
   4157  close(2)                          = 0
   4157  exit_group(1)                     = ?
   4157  +++ exited with 1 +++

   # cleanup and exit.

*HOWEVER* perhaps my system and strace do not "play well together".
A tutorial I found gave as a first example:      > strace -o mytrace
yabasic ls
That gave 10 {apparently spurious} file errors before running "ls" normally.

See above: since libraries and other auxiliary files can be at one of
several places, many open errors are just the normal noise due to "looking
around".

Strace's output can be at first overwhelming, but it's a good tool
to have around.

Now to solve logic flaws in my code ;/

Ah, that's the true joy :-)

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlt62hcACgkQBcgs9XrR2kauygCfYQHujYlJno4qvZ7bqOKvSKBG
CN4An3yyNA0JFRQiyF/5uce+yIbNtuzv
=h0BJ
-----END PGP SIGNATURE-----





Reply via email to