Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent errors from exec.command.output() #603

Open
luoliwoshang opened this issue Jul 29, 2024 · 0 comments
Open

Inconsistent errors from exec.command.output() #603

luoliwoshang opened this issue Jul 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@luoliwoshang
Copy link
Contributor

luoliwoshang commented Jul 29, 2024

When running the program with llgo, errors occur and they're different each time.

package main

import (
	"os/exec"
)

func decodeSymbolName(symbolName string) {
	println("decodeSymbolName", symbolName)
	cppfiltCmd := exec.Command("c++filt", symbolName)
	cppfiltOutput, err := cppfiltCmd.Output()
	if err != nil {
		println(err)
	}
	println(string(cppfiltOutput))
}

func main() {
	decodeSymbolName("__ZN9INIReaderC1EPKcm")
	decodeSymbolName("__ZN9INIReaderC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE")
	decodeSymbolName("__ZN9INIReaderC2EPKcm")
}

llgo/_cmptest/_falsedemo on  llcppg/symg/header [$!?] via 🐹 v1.20.4 took 9s 
❯ llgo run .
decodeSymbolName __ZN9INIReaderC1EPKcm
INIReader::INIReader(char const*, unsigned long)

decodeSymbolName __ZN9INIReaderC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
INIReader::INIReader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)

decodeSymbolName __ZN9INIReaderC2EPKcm
INIReader::INIReader(char const*, unsigned long)
(base) 
llgo/_cmptest/_falsedemo on  llcppg/symg/header [$!?] via 🐹 v1.20.4 took 2s 
❯ llgo run .
decodeSymbolName __ZN9INIReaderC1EPKcm
^C
(base) 
llgo/_cmptest/_falsedemo on  llcppg/symg/header [$!?] via 🐹 v1.20.4 took 5s 
❯ llgo run .
decodeSymbolName __ZN9INIReaderC1EPKcm
INIReader::INIReader(char const*, unsigned long)

decodeSymbolName __ZN9INIReaderC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
Unexpected state
Collecting from unknown thread
(base) 

The program runs normally when executed only once.

decodeSymbolName("__ZN9INIReaderC1EPKcm")
-decodeSymbolName("__ZN9INIReaderC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE")
-decodeSymbolName("__ZN9INIReaderC2EPKcm")
@xushiwei xushiwei added the bug Something isn't working label Jul 29, 2024
@luoliwoshang luoliwoshang mentioned this issue Jul 29, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants