bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16068: 24.3; Printing doesn't work


From: Андрей Парамонов
Subject: bug#16068: 24.3; Printing doesn't work
Date: Sat, 7 Dec 2013 16:40:24 +0400

Thank you very much for very clear and detailed instructions, Eli!
I got the following output:

(gdb) print *ppi2
$1 = {pServerName = 0x0, pPrinterName = 0x38a0136 <__register_frame_info+59375926> "RICOH Aficio 2018D PCL 6",
  pShareName = 0x38a0134 <__register_frame_info+59375924> "", pPortName = 0x38a0118 <__register_frame_info+59375896> "82.97.201.165",
  pDriverName = 0x38a00e6 <__register_frame_info+59375846> "RICOH Aficio 2018D PCL 6", pComment = 0x38a00e4 <__register_frame_info+59375844> "",
  pLocation = 0x38a00e2 <__register_frame_info+59375842> "", pDevMode = 0x389f1c0 <__register_frame_info+59371968>,
  pSepFile = 0x38a00e0 <__register_frame_info+59375840> "", pPrintProcessor = 0x38a00ce <__register_frame_info+59375822> "winprint",
  pDatatype = 0x38a00c6 <__register_frame_info+59375814> "RAW", pParameters = 0x38a00c4 <__register_frame_info+59375812> "",
  pSecurityDescriptor = 0x389f088 <__register_frame_info+59371656>, Attributes = 576, Priority = 1, DefaultPriority = 0, StartTime = 0,
  UntilTime = 0, Status = 0, cJobs = 0, AveragePPM = 0}

I see that pServerName, pShareName are not set, which confuses Fdefault_printer_name big time (e.g. it thinks the printer is local).
It seems that in my case the problem lies is a very exotic way of configuration. I'll try to setup printer in the orthodox way when I'm in the office next time. Current configuration was done by IT guy; I'm not sure why he decided to use numeric IP addess and port instead of simple share name.

Thank you for your support,
Andrey Paramonov


2013/12/6 Eli Zaretskii <eliz@gnu.org>
> From: Андрей Парамонов <cmr.pent@gmail.com>
> Date: Fri, 6 Dec 2013 16:00:34 +0400
> Cc: 16068@debbugs.gnu.org
>
> > Is it possible for you to step through default-printer-name with GDB
> > and see what happens there?  I can send you detailed instructions, if
> > you need them.
> >
>
> Please do.

See below, and thanks in advance.

> Is it correct that default-printer-name is implemented in C (which is why I
> need GDB)?

Yes, this is correct.

I see that you are using Emacs 24.3, which is an official release.  I
suspect that this binary has been stripped of debugging symbols, so
you will be unable to debug it on the C source level.  So the first
thing I suggest to do after installing GDB (let me know if you need a
link for a Windows port of GDB) is type this from the shell prompt:

  gdb /path/to/emacs.exe

If GDB says something like this:

 Reading symbols from D:\foo\bar\emacs.exe...(no debugging symbols found)...done.
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
then indeed the binary is stripped.  In that case, please download a
recent snapshot from here:

  https://sourceforge.net/projects/emacs-bin/files/snapshots/

and start by verifying that the same problem still exists there.  (It
could be that it was somehow fixed since 24.3 was released, although I
doubt that.)

Once you establish that the problem still exists in the snapshot,
here's the sequence of commands I'd like you to perform:

  gdb /path/to/emacs.exe

After GDB starts and displays its startup blurb, do this:

  (gdb) break Fdefault_printer_name
  (gdb) run -Q

The last command runs Emacs.  When Emacs starts up, it will show the
*scratch* buffer.  Type into that buffer:

  (default-printer-name)

Then go to the right parenthesis and type C-j.  This evaluates the
_expression_.  (Please forgive me if I'm telling you things you know
very well.)

When you evaluate that _expression_, the breakpoint you have set will
break, Emacs will stop, and GDB will take control.  Switch to the
window where you run GDB, you should see there something like this:

  Breakpoint 1, Fdefault_printer_name () at w32fns.c:7217
  7217      PRINTER_INFO_2 *ppi2 = NULL;
  (gdb)

(Since you don't have the sources, you will probably not see the
second line.)

If you want to see the source code of default-printer-name, you can
find it here:

  http://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/src/w32fns.c

(The function's source starts around line 7210 in that file.)

We want to get to line #7252, which is marked in the snippet below:

  err = GetPrinter (hPrn, 2, (LPBYTE)ppi2, dwNeeded, &dwReturned);
  ClosePrinter (hPrn);
  if (!err)
    {
      xfree (ppi2);
      return Qnil;
    }

  if (ppi2)  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    {
      if (ppi2->Attributes & PRINTER_ATTRIBUTE_SHARED && ppi2->pServerName)
        {

The GDB command to do that is:

  (gdb) until 7252

(The "(gdb)" part is GDB's prompt, you don't need to type it.)

GDB will step Emacs till that line, and respond like this:

  Fdefault_printer_name () at w32fns.c:7252
  7252      if (ppi2)
  (gdb)

Now please tell GDB to display the contents of the ppi2 structure,
which holds the printer information Windows returned due to the call
to GetPrinter API:

  (gdb) print *ppi2

And post here everything you see.

If you will do this in Emacs 24.3 (in case it does have the debugging
symbols), then please use "until 6943" instead of 7252 above, because
the source line numbers of the snippet I show above are different in
that version.

Thanks again for your help.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]