all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ralf Fassel <ralfixx@gmx.de>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: `print' does not print
Date: Fri, 22 Mar 2002 15:22:25 +0100	[thread overview]
Message-ID: <15515.15905.64808.177966@jupiter.akutech-local.de> (raw)
In-Reply-To: <3791-Fri22Mar2002135807+0200-eliz@is.elta.co.il>

* Eli Zaretskii
| To do that, you could either (a) use some utility, such as truss or
| strace, to report system calls issued by Emacs;

This is `par' on IRIX, which shows close(4) and close(5), but no (!)
write:
   ...
  579mS                 : open("/disk4/tmp/ralf/Software/emacs-21.2/foo", O_RDONLY, 0) = 5
  579mS                 : close(5) OK
  580mS                 : open("/disk4/tmp/ralf/Software/emacs-21.2/foo", O_RDONLY, 0) = 5
  580mS                 : close(5) OK
  582mS                 : open("/disk4/tmp/ralf/Software/emacs-21.2/foo", O_RDONLY, 0) = 5
  582mS                 : close(5) OK
finish

If I compile print.c alone with cc, and all the rest with gcc, I see
  ...
  575mS                 : open("/disk4/tmp/ralf/Software/emacs-21.2/foo", O_RDONLY, 0) = 5
  575mS                 : close(5) OK
  576mS                 : open("/disk4/tmp/ralf/Software/emacs-21.2/foo", O_RDONLY, 0) = 5
  576mS                 : close(5) OK
  578mS                 : open("/disk4/tmp/ralf/Software/emacs-21.2/foo", O_RDONLY, 0) = 5
  581mS                 : close(5) OK
  587mS                 : write(1, "\n", 1) = 1
  603mS                 : write(1, ""21.2.3"\n", 9) = 9
finish

The CPP-preprocessed print.c shows the `fwrite' call in both cases,
and the code is the same (apart from whitespace diff) after
preprocessing.

| or (b) invoke fwrite from GDB at the beginning of the Emacs `main'
| function (put a breakpoint in `main' to stop Emacs there), and see
| what it returns.

    % gdb ./emacs
    ...
    (gdb) br main
    Breakpoint 3 at 0x10162410: file emacs.c, line 708.
    (gdb) br print.c:333
    Breakpoint 4 at 0x1024c220: file print.c, line 333.
    (gdb) run -batch -no-site-file -l ../foo

    Breakpoint 3, main (argc=0, argv=0x0, envp=0x0) at emacs.c:708
    708	{
    (gdb) call printf("hello\n")
    hello
    $1 = 6
    (gdb) call fwrite("hello\n",6,1,(&__iob[1]))
    hello
    $2 = 1
    (gdb) c
Both of these seem to work when called via gdb.

    Breakpoint 4, printchar (ch=10, fun=273132596) at print.c:333
    333		  fwrite (str, 1, len, stdout);
    (gdb) call fwrite (str, 1, len,(&__iob[1]) )

    $3 = 1
Seems to have worked, newline is printed.
    (gdb) p str
    $4 = "\n\000\000"
    (gdb) n
    334		  noninteractive_need_newline = 1;
Nothing is printed in this step.

    (gdb) c

    Breakpoint 4, printchar (ch=34, fun=273132596) at print.c:333
    333		  fwrite (str, 1, len, stdout);
    (gdb) p str
    $5 = "\"\000\002\""
    (gdb) call fwrite (str, 1, len,(&__iob[1]) )
    $6 = 1
Nothing is printed yet due to line buffering on stdout, see below.
    (gdb) n
    334		  noninteractive_need_newline = 1;
    (gdb) disable 4
    (gdb) c
    "
This is the quote from further abvove, fflushed on exit, but nothing
else is printed.
    Program exited normally.
    (gdb) 

So the calls via gdb seem to work, while the calls from emacs itself
don't.  I do not understand this at all.

R'

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs


  reply	other threads:[~2002-03-22 14:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200203202019.g2KKJfs4410490@jupiter.akutech-local.de>
     [not found] ` <ap3lmcnkjy4.fsf@fosters.umd.edu>
2002-03-21 16:25   ` `print' does not print Eli Zaretskii
2002-03-21 17:10     ` D. Goel
2002-03-21 18:49       ` Ralf Fassel
2002-03-21 20:15     ` Ralf Fassel
2002-03-21 21:14     ` Ralf Fassel
2002-03-22 10:17       ` Eli Zaretskii
2002-03-22 10:41         ` Ralf Fassel
2002-03-22 11:58           ` Eli Zaretskii
2002-03-22 14:22             ` Ralf Fassel [this message]
2002-03-22 17:00               ` Eli Zaretskii
2002-03-22 17:47                 ` Ralf Fassel
2002-03-22 18:35                   ` Eli Zaretskii
2002-03-22 19:17                     ` Ralf Fassel
2002-03-22 20:11                       ` Eli Zaretskii
2002-03-22 22:18                         ` Ralf Fassel
2002-03-23  8:54                           ` Eli Zaretskii
2002-03-23 14:19                             ` Ralf Fassel
2002-03-23 16:48                               ` Eli Zaretskii
2002-03-23 17:10                                 ` Ralf Fassel
2002-03-22 20:44                   ` Stefan Monnier
2002-03-23 16:13           ` Richard Stallman
2002-03-24 16:51             ` Ralf Fassel
2002-03-24 18:16               ` Eli Zaretskii
2002-03-24 20:22                 ` Ralf Fassel
2002-03-25  6:02                   ` Eli Zaretskii
2002-03-25 13:47                     ` Ralf Fassel
2002-03-25 14:35                       ` Eli Zaretskii
2002-03-25 14:49                         ` David Kaelbling
2002-03-25 20:05                           ` Eli Zaretskii
2002-03-25 20:15                             ` David Kaelbling
2002-03-26  5:46                               ` Eli Zaretskii
2002-03-26 14:20                                 ` David Kaelbling
2002-03-26 14:28                                   ` Eli Zaretskii
2002-03-26 14:43                                     ` Ralf Fassel
2002-03-25 17:41                         ` Ralf Fassel
2002-03-25 17:55                           ` David Kaelbling
2002-03-25 20:14                           ` Eli Zaretskii
2002-03-25 21:33                             ` Ralf Fassel
2002-03-26  5:48                               ` Eli Zaretskii
2002-03-26 14:43                                 ` David Kaelbling
2002-03-26 17:30                                   ` Ralf Fassel
2002-03-27  5:49                                     ` Eli Zaretskii
2002-03-27  9:00                                       ` Ralf Fassel
2002-03-27  9:10                                         ` Eli Zaretskii
2002-04-12  9:37                                         ` Eli Zaretskii
2002-04-12 11:31                                           ` Ralf Fassel
     [not found]                                           ` <15542.50594.404120.372721@jupiter.akutech-local.de>
2002-04-12 15:08                                             ` David Kaelbling
2002-04-13 10:33                                               ` Eli Zaretskii
2002-04-13 10:52                                             ` Eli Zaretskii
2002-04-13 19:06                                           ` Richard Stallman
2002-03-25 12:01               ` Richard Stallman
2002-03-22 12:24 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15515.15905.64808.177966@jupiter.akutech-local.de \
    --to=ralfixx@gmx.de \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.