it seems  ldfags="-s=false" -gcflags="-l" can work

在2020年9月9日星期三 UTC+8 上午10:09:18<Ian Lance Taylor> 写道:

> On Tue, Sep 8, 2020 at 7:04 PM buaa...@gmail.com <buaa...@gmail.com> 
> wrote:
> >
> > I wrote a tool to get binary file's symbol table during initialization, 
> and do some special tests, but it fails on Linux, so I get the log like:
> >
> > $ go test
> > 2020/09/09 10:02:44 reading /tmp/go-build334351549/b001/xxx.test: no 
> symbol section
> > 2020/09/09 10:02:44 reading /tmp/go-build334351549/b001/xxx.test: no 
> symbols
>
> One approach you can use is to have the test build a program using "go 
> build".
>
> Or you can run your tests using "go test -c".
>
> Ian
>
>
> > 在2020年9月9日星期三 UTC+8 上午6:01:18<Ian Lance Taylor> 写道:
> >>
> >> On Mon, Sep 7, 2020 at 7:07 PM buaa...@gmail.com <buaa...@gmail.com> 
> wrote:
> >> >
> >> > There is no ldflags provided, so why the symbol table is stripped
> >>
> >> Because if you run "go test" without the -c option, the executable is
> >> built, run, and then thrown away. There no reason to spend time
> >> generating debugging information that nobody will ever use.
> >>
> >> Which leads to the question: how did you notice? What is the real 
> problem here?
> >>
> >> Ian
> >>
> >>
> >> > 在2020年9月8日星期二 UTC+8 上午10:05:33<buaa...@gmail.com> 写道:
> >> >>
> >> >> And only on Linux, there is no symbol section in test binary unless 
> I generate it by go test -c
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google 
> Groups "golang-nuts" group.
> >> > To unsubscribe from this group and stop receiving emails from it, 
> send an email to golang-nuts...@googlegroups.com.
> >> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/d8840e17-63c6-4f32-af1d-5d73d12dfbd4n%40googlegroups.com
> .
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to golang-nuts...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/93fd8c75-6e2d-4449-8912-a86fc70dee06n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/98f81f44-d49e-45d7-af74-816330991a50n%40googlegroups.com.

Reply via email to