m4-discuss
[Top][All Lists]
Advanced

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

Re: Make m4 only call macros surrounded by brackets.


From: Zack Piper
Subject: Re: Make m4 only call macros surrounded by brackets.
Date: Tue, 3 Mar 2015 14:38:55 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Mar 02, 2015 at 06:53:56AM -0700, Eric Blake wrote:
> On 02/28/2015 04:21 PM, Zack Piper wrote:
> 
> > 
> > Hm, I found out how to do it. Unfortuently it seems to segfault when using 
> > "changeword(`#<\([_a-zA-Z0-9]*\)>)')", and then trying to invoke a macro:
> > 
> > (gdb) run gpp.m4
> > Starting program: /usr/local/bin/m4 gpp.m4
> > Got object file from memory but can't read symbols: File truncated.
> > 
> 
> A segfault is never good.  Can you please post the contents of gpp.m4,
> show the exact version of m4 you are testing, and possible provide more
> of the backtrace, so that we can debug what went wrong?
> 
> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 

```{shell command="cat gpp.m4"}
define(`test', `hi')
changecom(`/*', `*/')
changeword(`#<\([_a-zA-Z0-9]*\)>')

#<test>
```

```{shell command="/usr/local/bin/m4 gpp.m4 --debug=V"}
m4debug: input read from gpp.m4
m4trace:gpp.m4:1: -1- id 1: define ...
m4trace:gpp.m4:1: -1- id 1: define(`test', `hi') -> ???
m4trace:gpp.m4:1: -1- id 1: define(...)

m4trace:gpp.m4:2: -1- id 2: changecom ...
m4trace:gpp.m4:2: -1- id 2: changecom(`/*', `*/') -> ???
m4trace:gpp.m4:2: -1- id 2: changecom(...)

m4trace:gpp.m4:3: -1- id 3: changeword ...
m4trace:gpp.m4:3: -1- id 3: changeword(`#<\([_a-zA-Z0-9]*\)>') -> ???
m4trace:gpp.m4:3: -1- id 3: changeword(...)


/usr/local/bin/m4: stack overflow
```

```{shell command="/usr/local/bin/m4 --version"}
m4 (GNU M4) 1.4.17
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Rene' Seindal.
```


```{gdb program="/usr/local/bin/m4"}
(gdb) run gpp.m4
Starting program: /usr/local/bin/m4 gpp.m4
Got object file from memory but can't read symbols: File truncated.





Program received signal SIGSEGV, Segmentation fault.
next_token (address@hidden, address@hidden) at input.c:918
918           if (regs.start[1] != -1)
(gdb) bt
#0  next_token (address@hidden, address@hidden) at input.c:918
#1  0x000000000040d77b in expand_input () at macro.c:67
#2  0x000000000040334b in process_file (name=0x7fffffffd6a0 "gpp.m4") at 
m4.c:350
#3  0x0000000000402fdd in main (argc=2, argv=0x7fffffffd138) at m4.c:642
(gdb)
```

I'm not great at using gdb, I hope that was an okay amount of backtrace.
-- 
I have nothing fancy or intelligent to put here.

Attachment: pgpZVV9dibvZZ.pgp
Description: PGP signature


reply via email to

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