unofficial mirror of bug-gnu-emacs@gnu.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 18:47:20 +0100	[thread overview]
Message-ID: <15515.28200.228210.321561@jupiter.akutech-local.de> (raw)
In-Reply-To: <2110-Fri22Mar2002190057+0200-eliz@is.elta.co.il>

* Eli Zaretskii
| This gets stranger and stranger...

Indeed :-/

| How about disassembly of printchar?  Does it show the call to fwrite
| in both cases?

You mean the assembler code output as of gcc -S ... print.c?  Yes, it
does show a call to fwrite, although in different syntax for gcc and
cc (which doesn't surprise me).

------------------------------
gcc
    .L22:
    .LM36:

	    lw	$2,noninteractive
	    beq	$2,$0,.L25
    .LM37:

	    addu	$2,$fp,24
	    move	$4,$2
	    li	$5,1			# 0x1
	    lw	$6,32($fp)
	    lw	$7,.LC0
	    la	$25,fwrite
	    jal	$31,$25
    .LM38:

	    li	$2,1			# 0x1
	    sw	$2,noninteractive_need_newline
    .LM39:
------------------------------
cc:
    .BB25.printchar:	# 0x2c8
	    .loc	1 333 4
     # 332  	{
     # 333  	  fwrite (str, 1, len, stdout);
	    addiu $4,$sp,0                	#  str
	    addiu $5,$0,1                 	#  
	    lw $6,4($sp)                  	#  len
	    lw $7,%got_disp(__iob)($gp)   	#  __iob
	    addiu $7,$7,16                	#  
	    lw $25,%call16(fwrite)($gp)   	#  fwrite
	    jalr $25                      	#  fwrite
	    nop                           	#  
    .BB26.printchar:	# 0x2e8
	    .loc	1 334 4
     # 334  	  noninteractive_need_newline = 1;
	    addiu $8,$0,1                 	#  
-------------------------

| What happens if you replace `fwrite' with `fflush' followed by
| `write'?  Does that change anything?

Errr, yes, it does.  If I apply the following diff:
*** print.c~	Wed Aug  1 10:27:38 2001
--- print.c	Fri Mar 22 18:35:49 2002
***************
*** 330,336 ****
  	}
        else if (noninteractive)
  	{
! 	  fwrite (str, 1, len, stdout);
  	  noninteractive_need_newline = 1;
  	}
        else
--- 330,339 ----
  	}
        else if (noninteractive)
  	{
! 		fflush(stdout);
! 		write (1, str, len);
! 
! 		/* fwrite (str, 1, len, stdout); */
  	  noninteractive_need_newline = 1;
  	}
        else

I get
    ./emacs -batch -no-site-file -l foo

    "21.2.1"

I.e. it `works'.

If I put at the start of main:
  write(1,"write\n",6);
  fwrite("frwite\n", 7,1,stdout);
I see the `write', but not the fwrite when I compile with gcc.  I see
both when I compile with cc.
    
| Another idea is to put a breakpoint inside fwrite, and see if it's
| called at all.

While gdb accepts the break command, it does not stop in fwrite in
both cases (gcc and cc).  However, cc-compiled prints, gcc-compiled
does not.

cc:
    (gdb) br fwrite
    Breakpoint 4 at 0xfa52f48: file engine.c, line 592.
    (gdb) c

    "21.2.1"

    Program exited normally.

gcc:
    (gdb) br fwrite
    Breakpoint 4 at 0xfa52f48: file engine.c, line 592.
    (gdb) c

    Program exited normally.
    
I don't know whether it makes much sense to dig deeper here.  While
I'm as curious what is the problem here, maybe I just go and fetch the
CVS version and see what happens there.

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 17:47 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
2002-03-22 17:00               ` Eli Zaretskii
2002-03-22 17:47                 ` Ralf Fassel [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=15515.28200.228210.321561@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).